J
Jon LeBaugh
HELP!
I am creating a new document based off a template
inserting data into it (from a form with it stored in forfields to this form
with bookmarks), printing it, then (trying to) close it. Code follows....
Set newbitdoc = Word.Documents.Add(mytemplatepathandname, , , False)
'code to put info into doc here
newbitdoc.PrintOut Background:=False
newbitdoc.Close wdDoNotSaveChanges 'errors here everytime
When it errors (error4198 -- command fails). I can debug it and run it from
there and it works perfectly. I can also run it from the VB Editor and it
works just fine there, but when I run it initiated from inside my first
document (entering a formfield triggers it) it crashes at the close
statement. I have tried it with the .printout statement commented out to see
if it was a problem with the document still printing with the same result. I
tried putting some doevents commands before the close statement, did not
affect it. The data I am inserting is pulled from formfields on the first
document and placed in bookmards on the document being created/printed/closed.
THANKS!!!
I am creating a new document based off a template
inserting data into it (from a form with it stored in forfields to this form
with bookmarks), printing it, then (trying to) close it. Code follows....
Set newbitdoc = Word.Documents.Add(mytemplatepathandname, , , False)
'code to put info into doc here
newbitdoc.PrintOut Background:=False
newbitdoc.Close wdDoNotSaveChanges 'errors here everytime
When it errors (error4198 -- command fails). I can debug it and run it from
there and it works perfectly. I can also run it from the VB Editor and it
works just fine there, but when I run it initiated from inside my first
document (entering a formfield triggers it) it crashes at the close
statement. I have tried it with the .printout statement commented out to see
if it was a problem with the document still printing with the same result. I
tried putting some doevents commands before the close statement, did not
affect it. The data I am inserting is pulled from formfields on the first
document and placed in bookmards on the document being created/printed/closed.
THANKS!!!