Create PDF when Particular Cell is Filled.

sathishsusa

New Member
Joined
Dec 7, 2016
Messages
30
Hello Experts,

I have 8 worksheet among filling form worksheet are first 3 worksheet.

when Sheet1 of Cell "AE32" is last signing part once its filled then confirm to Create the PDF first 3 worksheet ( Sheet1, Sheet2, Sheet3) and save PDF in path folder to open Dialog browse to choose location to save PDF.

Please can you help me out to solve the problems.


VBA Code:
Option Explicit

Public Sub SaveSheetsAsPDF()



    Dim wksAllSheets As Variant

    Dim wksSheet1 As Worksheet

    Dim strFilename As String, strFilepath As String

    

    'Set references up-front

    Set wksSheet1 = ThisWorkbook.Sheets("Sheet1")

    wksAllSheets = Array("Sheet1", "Sheet2", "Sheet3")

    strFilepath = "D:\My project\PTW SYSTEM"

    

    'Create the full Filename using cells D6, E6 and F6

    With wksSheet1

    

        'Assemble the string cell-by-cell, "D6 E6-F6"

        strFilename = strFilepath & .Range("A4").Value & "-" & " " & Format(Date, "dd-mmm-yyyy") & ".pdf"

        

    End With

    

    'Save the Array of worksheets (which will be selected) as a PDF

    ThisWorkbook.Sheets(wksAllSheets).Select

    wksSheet1.ExportAsFixedFormat _

              Type:=xlTypePDF, _

              Filename:=strFilename, _

              Quality:=xlQualityStandard, _

              IncludeDocProperties:=True, _

              IgnorePrintAreas:=False, _

              OpenAfterPublish:=True

              

    'Make sure all the worksheets are NOT left selected

    wksSheet1.Select



End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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