Hi,
I am using VBA to save all sheets on the workbook to a pdf file.
How can i count the number of pages on the pdf file ?Please Login or Register to view this content.
Hi,
I am using VBA to save all sheets on the workbook to a pdf file.
How can i count the number of pages on the pdf file ?Please Login or Register to view this content.
If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.
If your problem is solved, go to Thread Tools and select Mark This Thread Solved
Please Login or Register to view this content.
Alternative;
Please Login or Register to view this content.
Thanks porucha vevrku / Haluk.
However, both the options seems to give only the number / count of the sheets selected.
I was after the total number of pages in the pdf file (which would be sum of page number of individual sheets selected.)
For the attached, pdf file will have six pages but the vba code will return value of 3 for each of the cases which is the number of sheets selected.
Then, you will probably need another procedure or function to get the count of pages of the created file....
Is this going to be OK for you?
Haluk,
ANother procedure / function is fine if it works.
porucha vevrku Attached file again, hope it works. This has 8 pages on a pdf file.
Please Login or Register to view this content.
I also tried this method, but the results are inconclusive/unclear/ambiguous (?), sometimes there are 11 and sometimes 12 pages (the last page is blank).
Also withas Haluk suggested.Please Login or Register to view this content.
A 'pdf' printout is always 12 pages long => saravnepali has 8 pages -> "This has 8 pages on a pdf file"
I didn't change anything in the xls file => it seems the "pdf printer" has "different settings".
???
@ porucha vevrku
Re: "but the results are inconclusive/unclear/ambiguous (?)"
Not if you set the print areas in each sheet.
Please Login or Register to view this content.
I tried the option by jolivanes for different files and it works good.
Thanks.
You may try this, which was written a long time ago;
Please Login or Register to view this content.
If you think that if you're going to print 6 pages and you would miraculously end up with a different amount, I would say, yes, go for it.
Maybe ask saravnepali if he just wants to know the amount of pages or if he indeed only want to count them after like you suggest.
@jolivanes ;
I guess porucha vevrku means to say that; if you don't design (or forget to do do) the page setup of the Excel sheets before exporting as an PDF file, it would be an option, to get the count of pages of the created PDF file by another function.
So, let's leave the stage to the OP ...
Last edited by Haluk; 11-27-2020 at 04:00 PM.
@ porucha vevrku & @ Haluk
No offence at all. I think we all see people asking for a solution and they more or less supply us with what they they think should happen.
Most people that help on these forums have their own way of doing things, "All roads lead to Rome" comes to mind, so I think we should read between the lines and give a solution to what we think is needed.
If you find I was too abrupt in Post #15, just let me know. As the years progress on you, you tend to get that way. Another saying for that could be "Been there, done that and have the T-Shirt to prove it.
Anyway, keep up the good work you guys and I will try to do the same my way!!!
Hopefully we can needle each other in a positive way every so once in a while. Life at the moment is boring enough with all the restrictions we have to adhere to.
Last edited by mjr veverka; 11-27-2020 at 05:00 PM.
jolivanes, no problem .... good luck to all of us.
And, porucha vevrku .... I agree with you.
Last edited by Haluk; 11-27-2020 at 05:05 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks