Re: Control Word userform from Access

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Doug

I can't use System.PrivateProfileString as I cannot change the protected
templates and modules.
I'm going to try running a macro in my Word report template and see if that
can control the userform.

Paul

"Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx> wrote in message
news:eGsS3ba$FHA.3064@xxxxxxxxxxxxxxxxxxxxxxx
> Did you try the method that I suggested in my last post - using the
> System.PrivateProfileString?
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> <x> wrote in message news:uPeo9Oa$FHA.160@xxxxxxxxxxxxxxxxxxxxxxx
>> The userform is controlled by a document registration database that uses
>> Word to supply custom templates of reports, letters, faxes etc for our
>> organisation to use to eliminate holding hard copies of documents and for
>> better racking of all correspondence through the organisation. The
>> templates are used to standardise all these document types for
>> conformity, as in the past each department did their own thing which
>> didn't look professional. It also makes finding past documents relating
>> to a subject easier to find than looking through a dusty document
>> archive. All incoming correspondence is scanned as a TIFF image for
>> recording and the original destroyed except for original forms and some
>> other document types. These documents are then linked to any replys or
>> reports to keep them all together electronically. As you can imagine this
>> is a massive database. It can hold all Office document types except
>> Access databases or linked Excel spreadsheets (unlinked are fine).
>>
>> I have created a workplace health and safety database that generates
>> monthly reports in Access then pushes the data to Excel for analysis to
>> create four charts (easier to control), then on to a custom Word template
>> filling in four tables and pasting images of the four charts to report to
>> nine department managers and nine safety committee members. This report
>> then has to be registered in the document database and to do so requires
>> up to six fields to be filled in before registration can take place. Once
>> registered the reports are emailed to the recipients. The person running
>> this safety database cannot use the document database very well therefore
>> I'm trying to automate all that I can. In the past the safety database
>> reporting was all done manually with hard copies and took a lot of time
>> to do. This now takes less than a minute to run with automation except at
>> the registration stage, which the user has trouble with.
>>
>> The registration is controlled from Word using the normal.dot template to
>> create the custom toolbar that runs this process. This and the report,
>> letter and fax etc templates are protected even at the module level so
>> changing anything isn't an option as the datbase is supplied by a
>> contracted third party who periodically updates the system and any
>> suggestions we make have to be considered carefully and usually take
>> forever to implement as other organisations also use the system for their
>> document control.
>>
>> Well thanks for your suggestions and listening, if there isn't a way to
>> automate the registration maybe the user will have to learn to use the
>> system I guess.
>>
>> Regards
>> Paul
>>
>> "Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx> wrote in message
>> news:uOZJdwP$FHA.1408@xxxxxxxxxxxxxxxxxxxxxxx
>>>I guess one way you could do it then would be to use the
>>>System.PrivateProfileString to write the string to a .txt or .ini file
>>>before you called the userform and then, in the Initialize() event for
>>>the userform, you could use the System.PrivateProfileString once againt
>>>to retrieve the string from the .txt or .ini file and insert it into the
>>>text box.
>>>
>>> I guess I have to ask why you are using a userform in Word and not a
>>> form in Access?
>>>
>>> --
>>> Hope this helps.
>>>
>>> Please reply to the newsgroup unless you wish to avail yourself of my
>>> services on a paid consulting basis.
>>>
>>> Doug Robbins - Word MVP
>>>
>>> <x> wrote in message news:e9IaJON$FHA.1028@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Thanks for the reply Doug.
>>>>
>>>> The code is run from an Access module so 'Dim oform As UserForm1'
>>>> generates
>>>> an error in Access and the code halts. I have the Word object library
>>>> referenced.
>>>> The word object is bound early with 'Dim objWord As Word.Application'
>>>> which
>>>> references a Word template to start a new report document (protected
>>>> company
>>>> template).
>>>> Then I call the macro to open the form with objWord.Run "OpenForm" and
>>>> try
>>>> to access the userform with objWord.Userform1.Textbox1 =
>>>> strDocumentName.
>>>> The template is not editable so I cannnot change it, I just know the
>>>> name of
>>>> the macro, userform and textbox..
>>>> I'm using the ClipBoard_SetData and ClipBoard_GetData functions from
>>>> the
>>>> article 'ACC2000: How to retrieve information from the clipboard',
>>>> found on
>>>> Microsoft's MSDN site to place the result of the variable on the
>>>> clipboard
>>>> and then try and send it to the textbox. Pressing Ctrl + 'V' will paste
>>>> the
>>>> data into the textbox but I want to make it happen automatically.
>>>> What do you think?
>>>>
>>>> Thanks again.
>>>> Paul
>>>>
>>>> "Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx> wrote in message
>>>> news:e0hBiCM$FHA.272@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Dim oform As UserForm1
>>>>> Set oform = New UserForm1
>>>>> oform.TextBox1.Text = "Your String"
>>>>> oform.Show
>>>>>
>>>>>
>>>>> --
>>>>> Hope this helps.
>>>>>
>>>>> Please reply to the newsgroup unless you wish to avail yourself of my
>>>>> services on a paid consulting basis.
>>>>>
>>>>> Doug Robbins - Word MVP
>>>>>
>>>>> <x> wrote in message news:uf5WZLK$FHA.2264@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> Hi everyone
>>>>>>
>>>>>> I need help sending a text string to a texbox in a Word userform. I
>>>>>> can call the Word macro to open the userform but I can't paste or
>>>>>> send the result of a string into the textbox even though the cursor
>>>>>> is flashing in the box. How do you access the objects in the userform
>>>>>> assuming the userform name is Userform1 and the textbox is Textbox1?
>>>>>> Can it be done?
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>> Regards
>>>>>> Paul
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • access to word merge report questions
    ... We have a fairly good sized Access database that contains some info on ... automate this a bit so each of these templates is a report. ... the thing out and insert it into the chart. ...
    (comp.databases.ms-access)
  • Re: Dynamic Report
    ... report, then open the report in, what, IE, and cause it to be printed there? ... one of the steps necessary is to have it dynamically select a font size ... programming I provide to Word to perform the task. ... those templates to the sections of the text. ...
    (microsoft.public.access.reports)
  • Re: Outlook Macro
    ... Daily - IIP OE Report ... > where your email templates are kept. ... if you're new to Outlook VBA macros, ...
    (microsoft.public.outlook)
  • Re: access to word merge report questions
    ... database for that info and enter it into the form. ... automate this a bit so each of these templates is a report. ... the thing out and insert it into the chart. ...
    (comp.databases.ms-access)
  • Re: Dynamic Report
    ... report independently of the columns of the rest of the ... But I have no idea how to set up such templates as an ... Word could handle the sizing (font and column widths) and this could ... and printing "to fit". ...
    (microsoft.public.access.reports)