Run a macro in Word from command line to open envelope window

D

DBishop

I want to create a desktop icon that will open word and automatically open
the the "Tools | Letters and Mailings", "Envelopes and Labels" window.

I have recorded a macro that opens this window, but the window is modal so
the macro cannot be terminated until the window is closed and the code behind
the macro uses ActiveDocument.Envelope.Insert with the proper arguments to
insert the envelope.

I have also tried to use Sendkeys in the macro to send the [Alt] + "T"
(Tools), [Alt] + "e" (Letters and Mailings), [Alt] + "E" (Envelopes and
Labels) {Sendkeys "%(TeE)"} but when I run it, the current time gets inserted
into the document.

Any ideas?
 
D

Doug Robbins

If what you want to do is open Word and have an envelope as the active
document, you should create a template that is based on the desired envelope
and then use the /ttemplatename startup switch to start Word with a new
document based on a template other than the normal.dot template.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

DBishop

That would work, but the actual envelope template has everything that is
needed to enter the information, select whether or not to print the barcode,
automatically add it to a document, vs. just printing the envelope
immediately, etc. I would much rather be able to directly open the Envelopes
and Labels window and then enter the address from there.

Any more suggestions would be appreciated.
 
P

Peter

Try this:

Create a macro and add the following code:

- Dialogs(wdDialogToolsEnvelopesAndLabels).Show
- Add the macro to a toolbar or create your own
- Click the button on the toolbar to open the dialog box

This won't get an icon to automatically load the function, but at least you
don't have to go all the way through the tool menu to get to it. I was using
Word 2003. Hope this helps.
 
G

Graham Mayor

The original replies were not reproduced, but the simplest method of having
access to envelopes from the desktop is to drop a shortcut to an envelope
template there. There are sample templates for download from my web site
that would do the job.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Try this:

Create a macro and add the following code:

- Dialogs(wdDialogToolsEnvelopesAndLabels).Show
- Add the macro to a toolbar or create your own
- Click the button on the toolbar to open the dialog box

This won't get an icon to automatically load the function, but at
least you don't have to go all the way through the tool menu to get
to it. I was using Word 2003. Hope this helps.


DBishop said:
I want to create a desktop icon that will open word and
automatically open the the "Tools | Letters and Mailings",
"Envelopes and Labels" window.

I have recorded a macro that opens this window, but the window is
modal so the macro cannot be terminated until the window is closed
and the code behind the macro uses ActiveDocument.Envelope.Insert
with the proper arguments to insert the envelope.

I have also tried to use Sendkeys in the macro to send the [Alt] +
"T" (Tools), [Alt] + "e" (Letters and Mailings), [Alt] + "E"
(Envelopes and Labels) {Sendkeys "%(TeE)"} but when I run it, the
current time gets inserted into the document.

Any ideas?
 

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