Runtime Access / OLE Automation

F

FBxiii

Hi.

I have created a DB in Access that is used by a person who only has Runtime
access to the Application.

The App uses OLE automation to complete a standard letter template by using
a Find/Replace function. Sometimes this works fine and other days it does
not!

The code used for the automation is held within its own module and the
reference to Word is stored as a Global variable - appWord.

I am using Set appWord = GetObject("Filename.doc","Word.Document") to open
the template.

It seems on some days the App loses the reference to appWord as the user
gets an error of 'Error 91 - Object not set/found'.

I have trapped this error and am trying to use; Set appWord =
GetObject(,"Word.Document") to recall the reference but this gives me a new
error number 429.

This may seem a little confusing but does anyone have any suggestions?

Thanks in advance,
Steve.
 
A

Albert D. Kallal

Hum, I have a word merge that I used for about 7 + years with the runtime on
every conceivable combination of office from 97 to 2007, and it always
works...even when using different versions of word then ms-access.

The sample code is here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

What is nice/interesting about my sample is that is specially designed to
enable ANY form with ONE LINE of code....

Thus, each time you build a new form, you can word merge enable it with
great ease.

Make sure you read the instructions from above, and you should eventually
get to the following page
http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html

Note that the merge can also use a query, and thus you don't have to merge
just "one" record..

After the merge occurs, you get a plain document WITHOUT any merge fields,
and this allows the end user to save, edit, or even email the document
(since the merge fields are gone after the merge occurs).

Give the above a try.

Of course, I don't use bookmarks, or find and replace in the text.

Furthermore, do keep in mind that any un-trapped runtime error will result
in ALL variables being reset.

the solution to the above re-set of values problem is:

a) always place error trapping in your code.
or,
b) simply use a mde....with a mde, then un-trapped errors does not re-set
all variables -- it will make your code FAR more reliable if you do this...
 
F

FBxiii

HI, thanks for the reply.

Unfortunately I cannot look at the links you gave me as they get stopped by
the internet filters at work.

I do have error trapping in my code, but converting the system to an mde
could be an option.

Thanks,
Steve.
 

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