Re: MS Word Automation
From: Andreas (nobody_at_home.com)
Date: 03/24/05
- Next message: Andreas: "Re: HELP - Cant Open the MDB database"
- Previous message: Brendan Reynolds: "Re: Using ADO: locating and reading contents of fields from specific"
- In reply to: Michael: "MS Word Automation"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Mar 2005 22:41:54 +1200
Create a object variable for the document itself.
Then refer to the document variable instead of the application variable.
Also, you might want to use a With ... End With.
Regards,
Andreas
Michael wrote:
> I am trying to export a large number of records one at a time into a word
> template .dot file from access. The problem that I am having is that each
> time a new document is created from the template I have to click on the
> header of the Word application for the code in access to progress. The code
> just seems to hand after the document is created. Aside from this
> undesirable user intervention the sub-routine seems to work. How do I get
> rid of the pause?
>
> I used the following code:
> Set objWord = CreateObject("Word.Application")
> objWord.Documents.Add "The Path To The Template IS Here", _
> NewTemplate:=False, DocumentType:=0)
> ObjWord.Application.Visible =True
> .....This is where we pause until I click on the Header of the Word App
> objWord.Slection.MoveDown Unit:=wdLine, count:=12
> The previous line skips past the protected(Form) sections of the document
> Fonts are set and the fields are entered here.
> objWord.Activedocument.SaveAs "File Path and name"
> objWord.ActiveDocument.Close
> objWord.Quit
>
> Is there some way for me to give focus to Word from the code in Access
> without manually clicking the Word header with each pass of the code?
>
> Thanks,
> Michael
>
- Next message: Andreas: "Re: HELP - Cant Open the MDB database"
- Previous message: Brendan Reynolds: "Re: Using ADO: locating and reading contents of fields from specific"
- In reply to: Michael: "MS Word Automation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|