Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Trying to automate several Word tasks in VB6

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith - 23 Jul 2005 14:28 GMT
Hi,

I've got a Word Doc that I'm using as a template for a mail merge
(MyTemplate.Doc).  I'm using a text file for the data records (MyData.txt).  
I need to automate the following tasks:

1.  Open MyTemplate.Doc
2.  Select a specific printer (HP LJ 9050DN PCL 6)
3.  Set the page size to 11X17
4.  Set the duplexing to Vertical
5.  Set the Orientation to Landscape
6.  Perform the Mail Merge
7.  Print the newly merged document
8.  Save the newly merged document using a filename parameter supplied by VB
9.  Close both documents

I've been able to perform some of the above tasks (1, 6, 9) but I could use
some help on the others.  Thanks for any help.

Keith
Peter Aitken - 23 Jul 2005 16:26 GMT
> Hi,
>
[quoted text clipped - 19 lines]
>
> Keith

The easiest way is to perform the desired steps with the macro recorder
turned on. Then you can look at the recorded code and make any needed
changes.

Signature

Peter Aitken

Remove the crap from my email address before using.

Doug Robbins - 23 Jul 2005 16:49 GMT
The page size and orientation should be set in the template and not require
setting via code.

See the article "How to do a mail merge to the printer using VBA, without
displaying the Print dialog" at:

http://word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm

Also check the mailmerge function in the visual basic editor to learn the
context and method of using it.

Also see the article "Changing the selected (current) printer in Word
without changing
the system default printer" at:

http://word.mvps.org/FAQs/MacrosVBA/ChangeCurPrinter.htm

Signature

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

>> Hi,
>>
[quoted text clipped - 23 lines]
> turned on. Then you can look at the recorded code and make any needed
> changes.
Jay Freedman - 23 Jul 2005 20:22 GMT
For step 4 (duplexing) and some of the others, see Jonathan West's
articles:
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132

--
Regards,
Jay Freedman
Microsoft Word MVP         FAQ: http://word.mvps.org

>The page size and orientation should be set in the template and not require
>setting via code.
[quoted text clipped - 40 lines]
>> turned on. Then you can look at the recorded code and make any needed
>> changes.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.