Consulting

Results 1 to 2 of 2

Thread: Saving and printing with copy numbers

  1. #1

    Saving and printing with copy numbers

    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:
    [vba]' 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
    [/vba]
    Now I've found the following piece of code on MSDN which, does bring up the save-as box.

    [vba]Dim dlgSaveAs As FileDialog
    Set dlgSaveAs = Application.FileDialog( _
    FileDialogType:=msoFileDialogSaveAs)
    dlgSaveAs.Show
    [/vba]
    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

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •