problem creating a word document

A

AndréG

I am having a intermittent problem creating a word document based on a
template from within access VBA.

i.e. it happens sometimes but not always

I use:
Global WordApp As New WordAppClass
dim worddoc as word.document
..
Set WordDoc = WordApp.Add(sWordtemplate)
DoEvents
..
WordDoc.SaveAs FileName:=sfname
DoEvents
..
WordApp.Activate
.... and then filling the document programatically.

Usualy but not always when word is not yet active and loaded for the first
time the word application shows up with the correct document and text but
WITHOUT TOOLBARS and no way to activate them.
Closing word and then reopening the previously created .doc file using:

Set WordDoc = WordApp.Add(sfname)

works.

If word is in memory i.e. appears in taskbar then the template creation
works fine.

Since I upgraded my hardware to a faster system the frequency of that
problem increased

It really seems that it has something to do with timings or sequence of
operations in my VBA code

does somenone have a clue ?

rgds
 
Top