MULTIPLE PRINTING BUTTONS IN ONE WORKSHEET

ELVING

New Member
Joined
Oct 24, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

im triyng to make 2 difrent printing buttons 1 for pdf printing and 1 for physical paper print, i make 2 macros for each individual button but exel only prints depending on the printer i have selected on the file/Print. no matter what i do i dont seem to find a way to make the macros work individualy on each button. can somebody tell me if theres a way to make this work
EXEL PICTURE.jpg
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
VBA Code:
Option Explicit

Sub Export_Worksheet_to_PDF()

    Dim mypath As String, fname As String
    mypath = ThisWorkbook.Path
    fname = CreateObject("Scripting.FileSystemObject").GetBaseName(ThisWorkbook.Name)
    ActiveSheet.Range("A1:R406").ExportAsFixedFormat 0, mypath & "\" & fname
    '           ^^^^^^^^^^^^^^^^
    '           ^^^^^^^^^^^^^^^^
    ' Change the above range to cover the INVOICE RANGE only.
    ' If the upper left corner of the invoice is located in cell A1 and the lower right hand
    ' corner is located in cell J23, then edit Range("A1:R406") to Range("A1:J23")
    'Saves the invoice as a PDF in the same folder as this workbook.

End Sub

Sub PrintInvoice()

Dim Cancel As Boolean
Dim Mensaje, Resp
Dim dlgPrint As Boolean
        
        Application.EnableEvents = False
        [L8] = [L8] + 1
        dlgPrint = Application.Dialogs(xlDialogPrint).Show
            If dlgPrint = False Then
                [L8] = [L8] - 1
                Cancel = True
                Application.EnableEvents = True
                Exit Sub
            End If
            

Application.EnableEvents = True

End Sub


Download workbook : https://drive.internxt.com/sh/file/40b475e4-c857-43e9-85fe-3ff9e94fda55/cd70bc7e37568f457830816b40247ffab4685e5f975066d6d5bcf9552fc7bc71
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top