save xlsm to pdf in pages

kingcc

New Member
Joined
Oct 9, 2017
Messages
11
I want a macro to save xlsm to pdf in range.
I have this macro but many times the range changes.
It is better to say the pages.
For example my macro save the sheet from 1 to 30 page.
But I gave the range of these pages not the number.
First is hot to write it as pages.
And second how can i change the 1 to 30 pages.
For example to 1 to 20 pages?
I am thinking with a box dialog.
<code>Sub TOPDFSELALL()

Sheets("teliko").Range("a1:H390").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"Z:\katalogoi\Book1.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub
</code>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi, welcome to the forum; you can give this a try:

Code:
Sub TOPDFSELALL()


Dim FromPage As Long, ToPage As Long


FromPage = Application.InputBox("Enter the from page number", Default:=1, Type:=1)
ToPage = Application.InputBox("Enter the to page number", Default:=1, Type:=1)


Sheets("teliko").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"Z:\katalogoi\Book1.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True, From:=FromPage, To:=ToPage


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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