Log in

View Full Version : Saving and printing with copy numbers



absoprob
06-16-2007, 06:09 AM
Hi,
I've picked up a piece of code from vitalnews.com (sorry, not allowed to post the actual link being a newbie) that works nicely in allowing me print off blank order forms, each with a unique incremented number.

This is great for orders that are to be hand written. What I want now is to save copies of the blank order form for typing detail into - but again, with a unique number for each copy saved.

The bit that does the printing (in the working code referred to) is:
' loop through the print-write-print cycle
For lCounter = 0 To lCopiesToPrint - 1
' update the document variable
ActiveDocument.Variables("CopyNumP") = _
lCopyNumFrom + lCounter
' print this numbered copy
ActiveDocument.PrintOut Copies:=1
Next lCounter

Now I've found the following piece of code on MSDN which, does bring up the save-as box.

Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog( _
FileDialogType:=msoFileDialogSaveAs)
dlgSaveAs.Show

The bit I seem to be missing is to take the file name and path given by the Save As box, then to use it to save the ActiveDocument. Am I right?
Then I could have: ActiveDocument.SaveAs ('strPathAndFilename').

The uniquely numbered and named copies could then be used to type in the order then print or fax.

Am I along the right lines here?
Could a totally different approach serve my needs better?

Any assistance or suggestions appreciated :)

Rgds,
ap

mdmackillop
06-17-2007, 01:02 PM
Hi
Welcome to VBAX
Have a look at the following KB Items. Any queries, let us know.
Regards
MD
http://www.vbaexpress.com/kb/getarticle.php?kb_id=56
http://www.vbaexpress.com/kb/getarticle.php?kb_id=348
http://www.vbaexpress.com/kb/getarticle.php?kb_id=351