Eliminating automation pause caused by drop down box in word templ

M

Michael

I am trying to insert some records from access into a word template. The
template is protected for forms and contains some drop down boxes. The
problem that I am having is that when the word document is opened the first
drop down recieves focus and the drop down list appears...the code
pauses...but as soon as I mouse click on anything on the screen the code
resumes moving to the end of the document and adding the text, the document
is saved and closed , the next document is created - again requiring user
intervention to click on anything.

I assume the problem lies in the section of code that creates the word
document from access.

'instantiate a new word document from template
set objword = createobject("word.application")
with objword
.documents.add _
strTemplatePath, _
newtemplate:=false, documenttype:=0
.application.visible = true

'move to the entry point and set the font
with .selection
.movedown unit:=wdline, count:=14
'...cycle through tables, insert text, and format text
end with
end with

At first I thought I needed to give focus to word somehow, but when I
realized that clicking on the desktop or the windows task bar caused the code
to resume I became unsure.

I would appreciate any help eliminating this inconvenient pause.

Thanks
-Michael
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?TWljaGFlbA==?=,

Not being able to see all your code, it's difficult to say for sure what's
causing the dropdown to show. But from what I can see, it could certainly be due
to your using the SELECT method and the SELECTION object. These should be
avoided; you should work with ranges and other objects. In that case, the
problem would likely go away.
I am trying to insert some records from access into a word template. The
template is protected for forms and contains some drop down boxes. The
problem that I am having is that when the word document is opened the first
drop down recieves focus and the drop down list appears...the code
pauses...but as soon as I mouse click on anything on the screen the code
resumes moving to the end of the document and adding the text, the document
is saved and closed , the next document is created - again requiring user
intervention to click on anything.

I assume the problem lies in the section of code that creates the word
document from access.

'instantiate a new word document from template
set objword = createobject("word.application")
with objword
.documents.add _
strTemplatePath, _
newtemplate:=false, documenttype:=0
.application.visible = true

'move to the entry point and set the font
with .selection
.movedown unit:=wdline, count:=14
'...cycle through tables, insert text, and format text
end with
end with

At first I thought I needed to give focus to word somehow, but when I
realized that clicking on the desktop or the windows task bar caused the code
to resume I became unsure.

I would appreciate any help eliminating this inconvenient pause.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top