Converting Hidden Sheets to PDF

sabbuck

New Member
Joined
Aug 21, 2017
Messages
24
Hi All,

I have 5 Sheets in a workbook named "Loan Appraisal Form", "Loan DSR", "RLEs", "Welcome" and "Main Menu".

All sheets are protected with some cells unlocked for editing. The "Main Menu" sheet is the only sheet visible. "Loan Application Form" and "Loan DSR" are only visible when a button for each is clicked on the "Main Menu".

"Welcome" and "RLEs" are always very hidden.

I want to put a button on the "Main Menu" sheet so that when its clicked the "Loan Appraisal Form" and "Loan DSR" convert to one PDF document.

Is this possible?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this. It creates a file named "Loan.pdf" in the same folder as the macro workbook.
Code:
Public Sub Create_Loan_PDF()

    Dim currentSheet As Worksheet
    
    Application.ScreenUpdating = False
    With ThisWorkbook
        Set currentSheet = .ActiveSheet
        .Worksheets("Loan Appraisal Form").Visible = xlSheetVisible
        .Worksheets("Loan DSR").Visible = xlSheetVisible
        .Worksheets(Array("Loan Appraisal Form", "Loan DSR")).Select
        .ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=.Path & "\Loan.pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
        .Worksheets(Array("Loan Appraisal Form", "Loan DSR")).Visible = xlSheetHidden
        currentSheet.Select
    End With
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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