Word EditGoto Destination

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using an access form that loads the data into a word document and shows
the completed ms word document.
The word document can later be prined or saved. The code has several
references top the word document as shown below

WordObject.AppShow
If WordObject.AppMinimize() Then
WordObject.AppMaximize
End If

If Not IsNull(txtAB_NUM) Then
WordObject.EditGoto Destination:="txtAB_NUM"
WordObject.INSERT Trim(txtAB_NUM)
End If

The database users are able to see the word document. I am not able to. It
doesn't load a document at all. I tried putting an empty document. When I run
the application, it opens it, but doesn't populate the document according to
the code. When I debug it, it exits at the first If condition. The users
sample document provided has numerous horizontal lines, boxes, color shades
etc.. The code doesn't seem to be doing that many things. Could they be using
any formatted template? If so, I'll ask them.

Thanks in advance
 
It looks as if you're using the old WordBasic object, obsolete for the
last eight or ten years. You'll get much more control and better error
handling if you rewrite the code to use Word.Application and
Word.Document objects.

Also, the code will fail if the document doesn't contain a bookmark
named "txtAB_NUM". By definition, an empty document doesn't contain such
a bookmark; also, any time you use code to insert text at a bookmark,
the bookmark is deleted.
 
Back
Top