Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi,

    Please take a quick look at the code below. It asks if I want a spread sheet sent by email and then asks if I want to send it by fax. I have to answer both questions on screen by clicking Yes or No in the message box that pops up.

    I would prefer not to have to deal with a message box for FAXING the spreadsheet if I've farleady answered YES to sending it by email. If I'm sending it by email then I'm not going to be sending it by fax also.

    Is there a way to code this so the Fax message box does not come up if I answered Yes to the email message box? Below is how the code is written in my printing macro.



    ' THE FOLLOWING STATEMENT PRINTS A COPY OF THE QUOTE TO PDF FACTORY IF BEING SENT BY EMAIL

    If MsgBox("Is this quote being sent by email?", vbQuestion + vbYesNo) = vbYes Then

    Application.ActivePrinter = "pdfFactory on FPP3:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
    "pdfFactory on FPP3:"
    End If



    ' THE FOLLOWING STATEMENT PRINTS THE QUOTE TO THE WIN-FAX DRIVER

    If MsgBox("Is this quote being sent by fax?", vbQuestion + vbYesNo) = vbYes Then
    Application.ActivePrinter = "WinFax on Ne01:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
    "WinFax on Ne01:", Collate:=True
    End If



    As always thanks for all your help,
    BH

  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
    How about something like this?:

    [codebox]Dim iResponse As Integer
    'Check if emailing
    iResponse = MsgBox("Is this quote being sent by email?", _
    vbQuestion + vbYesNo)
    If iResponse = vbYes Then 'Yes to email
    Application.ActivePrinter = "pdfFactory on FPP3:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
    ActivePrinter:="pdfFactory on FPP3:"
    Else ' No email, check for fax
    If MsgBox("Is this quote being sent by fax?", _
    vbQuestion + vbYesNo) = vbYes Then
    Application.ActivePrinter = "WinFax on Ne01:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
    ActivePrinter:="WinFax on Ne01:", Collate:=True
    End If
    End If[/codebox]

    Steve

  3. #3
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post
    Steve,

    That did the trick. Thank you. I really appreciate your taking the time to write it out.

    BH

Posting Permissions

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