Print in pdf format

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all..

i want this macro below can print or save in pdf format at multiple based record selected..
this macro code :
Code:
[COLOR=#333333]Sub PrintPhoto()[/COLOR]<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">Dim fromRecord, toRecord, answer, i As Integer
On Error Resume Next

fromRecord = InputBox("From record", "FROM", 1)
    If fromRecord = 0 Or Not IsNumeric(fromRecord) Then Exit Sub
toRecord = InputBox("To record", "TO", fromRecord)
    If toRecord < fromRecord Or Not IsNumeric(fromRecord) Then Exit Sub
answer = MsgBox("printing records" & fromRecord & " to " & toRecord, vbOKCancel, "PRINT")
    If answer <> vbOK Then Exit Sub
    
For i = fromRecord To toRecord
    [AM8] = i
    With ActiveSheet
        .PrintOut
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
Next
 </code>[COLOR=#333333]End Sub[/COLOR]

here this attachment file
https://app.box.com/s/19nsaj2e6ka1wxwnoiyfu0u6k1d9y0yr

any body would help me , greatly appreciated...

m.susanto
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi muhammad,

You can save a workbook as a PDF (Portable Document Format), but you print any type of file regardless.

I do not understand what you are asking? Could you please add some more details to exactly what you need?
 
Upvote 0
if i use pdf print i should order print per page can't excute multiple print
my expected result is how to excute at selected records from .?...to record .?...at once click. (based on my attach data)
 
Upvote 0
Hi muhammad,

Again I say your message lacks a lot of details to understand what you are trying to accomplish. We are all here ready to help. But we need information to be able to help you properly. If you do not give us enough information to make a mental picture we will NEVER be able to give you a good answer.

Plus I saluted you and said Hi, you did not reciprocate, what gives?

Again, give more details so that we can better assist you.

Now, what I understand is that you are trying to make PDF files, and print them, so you can use a Loop to make/print multiple times.
 
Last edited:
Upvote 0
hi phils...

you're right..i want to print pdf format .please, check & run my attach.
my problem is i must one by one record to make pdf format..
i agree for your suggestion to use Loop but i don't have knowlagde about macro/vba..
would you like to help me?
 
Upvote 0
i hope someone could help me...
i just wanna to print my excel as pdf format, based on certain record [file attachment]
 
Upvote 0

Forum statistics

Threads
1,216,460
Messages
6,130,771
Members
449,589
Latest member
Hana2911

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