Here is my code
VBA is not printing the correct area instead it is printing C3:X212. (The correct area is "$c$3:$AA$212")
Can someone help?
![]()
Please Login or Register to view this content.
Here is my code
VBA is not printing the correct area instead it is printing C3:X212. (The correct area is "$c$3:$AA$212")
Can someone help?
![]()
Please Login or Register to view this content.
Can your columns C:AA all fit on one page width? You may have to play with the page margins, zoom to fit, and\or font sizes to get it to fit.
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
I set all margins to zero already
When I looked at the pages to be printed it all seems fine but when it prints to PDF it is out of whack
Here are the pics
http://i.hizliresim.com/5VaM7z.jpg
http://i.hizliresim.com/y46L5k.jpg
http://i.hizliresim.com/2Z68Z2.jpg
Last edited by misterno; 06-22-2016 at 04:22 PM.
Maybe a little reorganizing:
![]()
Please Login or Register to view this content.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
How is it different than the print preview?
To get the right page setup for zoom to fit, record a Print but then cancel the actual print, stop recording, and then view the code.
Print preview has the whole area covered whereas the printed PDF is cut off on X column instead of AA
I just saw your recommendation, let me try
EDIT: Here is the code it recorded
So how to incorporate this into my VBA?![]()
Please Login or Register to view this content.
Last edited by misterno; 06-22-2016 at 04:44 PM.
Replace the last line of the macro I suggested with that snippet above instead.
I did but the last paragraph reds out so it does not work
But if I do this![]()
Please Login or Register to view this content.
then it just prints and of course I want to save it as PDF![]()
Please Login or Register to view this content.
Last edited by misterno; 06-22-2016 at 05:08 PM.
Printto, well prints to your printer. What you want is to export to pdf. You got the PrintTo from recording a macro and printing I guess. I said to cancel printing. You can see the many options set when I set it to Fit All. I doubt that you need all of the options set.
Another area of confusion is the folder name versus the file name. See my comments. I am not sure which is correct.
I have not tested this since I don't have your worksheets.
![]()
Please Login or Register to view this content.
great now I am getting this
http://i.hizliresim.com/ZdXd1o.jpg
EDIT: restarted the pc and now it is working
I need to play around with the margins to make it better though
Can you tell me what made it work this time?
Also I need to insert 2 charts to my PDF located in "New England Balances" tab.
Chart1 and Chart3 are the names and they are located at the right hand side.
How to insert these to my PDF in a seperate page?
Last edited by misterno; 06-22-2016 at 05:43 PM.
Order of PDF pages is governed by the sheet index order. As such, try to do this manually first.
Insert a worksheet for each chart. Set each sheet's print range which encloses the chart(s). Group select the worksheets in consecutive order. Look at Print Preview. Then try a File > SaveAs > PDF.
IF that works, we can make a macro to do it.
If not, things get more complex. Another method would be needed which might require Acrobat (not the reader) or a third party program. One would export each range and chart as a picture file and then merge the picture files and Save to PDF.
If the manual method works, workup a short example file with obfuscated data and attach the file.
Kenneth
Here is the code but it is not working. It is just printing the sheets but not the chart. Can you help?
(I am trying your recommendation now)
![]()
Please Login or Register to view this content.
Here is the code you suggested
So I inserted a line for the chart are (highlighted) but it is not printing at all not even the sheets itself
![]()
Please Login or Register to view this content.
Last edited by misterno; 06-23-2016 at 12:00 PM.
nmxdvxcvcvcv
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks