Code to export excel to Pdf

Status
Not open for further replies.

Chris1973

Board Regular
Joined
Apr 17, 2020
Messages
115
Office Version
  1. 2016
Platform
  1. Windows
Gooday everyone.

If this is a duplicate post do i apologize i do not see the post i posted earlier

Still me with my problem of exporting a excel sheet to pdf format.

I have tried numerous codes ( which strangely enough work on their own)

My problem is i need to save a excel workbook(xlsm enabled) to xlsx and pdf format .

I am currently using this code for the sake of saving to xlsx, and it works 100%

PLEASE NOTE THIS CODE WORK 100% NO PROBLEM HERE

Private Sub CommandButton1_Click()

Dim Path As String

Dim Filename1 As String

Path = "C:\Users\chrish\Documents\1.Wurth Master\3.Quotes and Brochures\Excel\"
Filename1 = Range("D8").Text
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Path & Filename1 & ".xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close


End Sub

I need a code to save above mentioned code and then to EXPORT PDF

pdf must be exported (saved) to

cell range : D4 AND D8 must be saved
Path: C:\Users\chrish\Documents\1.Wurth Master\3.Quotes and Brochures\Pdf

so in short
xlsx must be saved in
range:D8
PATH:"C:\Users\chrish\Documents\1.Wurth Master\3.Quotes and Brochures\Excel\"

and pdf must be saved to

cell range : D4 AND D8 must be saved
Path: C:\Users\chrish\Documents\1.Wurth Master\3.Quotes and Brochures\Pdf


Anyone that can help.

I had tremendous help over the weekend, unfortunately for one or other reason does nothing want to work
 
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You can find your threads like this

1587472865403.png


Thread closed as duplicate
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

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