Pass parameters to template opened from VB project

E

Ernest Gunn

Hello, all

I am trying to automate printing for a series of documents using VB6. I can
do this easily

Set mwd = New Word.Application
Word.Documents.Open FileName:="C:\Documents and Settings\Ernie\My
Documents\Highland Park\Seating Charts\6th.doc"
Documents("6th.doc").PrintOut
Documents("6th.doc").Close savechanges:=False

I have trouble when I want to create a new document based on a template with
an autorun macro.

Documents.Add Template:="oCalendar.dot"

The oCalendar.dot template opens with a UserForm and I'd like my project to
pass the necessary parameters to it, then send the enter keypress, then wait
while the document is created so that I can print it. I'm stumped and I'd be
grateful for any help.

Thanks in advance

Ernest Gunn
 
J

Jonathan West

Hi Ernest,

Try including the following in your code just before you create the new
document

mwd.WordBasic.DisableAutoMacros 1

at the end of your macro, add this

mwd.WordBasic.DisableAutoMacros 0

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
E

Ernest Gunn

Thanks for the fast reply. However, what I want to be able to do is to _run_
the autoMacro so that the document will be created before I print it. This
autoMacro wants a couple of values and a click event, and I am hoping to
learn how an independent project can pass these on. Should I try another
group? Thanks.
 

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