Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Number of Pages in Message Box (2000/XP)

    I want a message box to pop up and inform the user how many sheets of paper to load after printing.

    The number of pages vary, so I need something based on &[Pages]

    Here's what I have for my code:

    WindowsName = MsgBox("Report has printed. Please load legal paper in printer.")

    I need it to read "Report has printed. Please load 14 sheets of legal paper in printer." With 14 being the variable.

    Is this possible?

    Thanks in advance.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Number of Pages in Message Box (2000/XP)

    The number of pages in the selected sheets can be obtained with this code snippet

    Steve

    <pre> Dim sht
    Dim iNumPages as integer
    'other dim statements

    'other code here

    iNumPages = 0
    For Each sht In ActiveWindow.SelectedSheets
    iNumPages = iNumPages + _
    (sht.VPageBreaks.Count + 1) * _
    (sht.HPageBreaks.Count + 1)
    Next sht

    'other code here

    WindowsName = MsgBox("Report has printed. Please load " & iNumPages & _
    "sheets of legal paper in printer.")
    </pre>


Posting Permissions

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