Hello,
Is there a code I can use to show a a sheet from my workbook as a single PDF file by pressing a button from another sheet?
Regards
Oeysbrei
Hello,
Is there a code I can use to show a a sheet from my workbook as a single PDF file by pressing a button from another sheet?
Regards
Oeysbrei
Perhaps see either of these sites for instructions:
http://www.rondebruin.nl/pdf.htm
http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
(Ron is the author of both pages, and provides many examples of working with Excel.)
Thanks for youre reply.
I have only been working with VBA and macros for a few months, so the code from the posted websites dident make sence to me.
Does anybody have a code for this purpose that will only open a selected sheet from a workbook as a PDF file.
Regards
Oeysbrei
Hi,
I have this code that makes me save a single sheet in a PDF format.
What I need is the saved file to be opened after saved. What more do I need to add to this code to make it perform this task.
When I try to open this file manually, I get a message that tells me it cant get opened because the format is not supported.![]()
Private Sub CommandButton2_Click() Static FileCount As Long Ark5.SaveAs Filename:="C:\Users\Oystein\Desktop\BTF\Hovedprosjekt\Exel prosjekt\Rapport\" & "BBA" & FileCount + 1 & ".pdf" FileCount = FileCount + 1 End Sub
Is there a way I can solv this?
Regards
Oeysbrei
If you record a macro of you saving a worksheet as a PDF you'll see the code that you need to adjust to fit your model.
Edit your sheet name (or variable.. Ark5?) as needed.![]()
Private Sub CommandButton2_Click() Static FileCount As Long Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\Users\Oystein\Desktop\BTF\Hovedprosjekt\Exel prosjekt\Rapport\BBA" & FileCount + 1 & ".pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True FileCount = FileCount + 1 End Sub
Paul,
It worked perfect once, but after that I get an error wile it tryes to open the file. The error is in adobe and tells me access denied.
Do you have any idea why?
Regards
Oeysbrei
Paul,
THANK YOU, it worked perfect.
Now the rest will be a walk in the park until next project.
Regards
Oeysbrei
Unfortunately I don't know the reason. It is working for me in my simple test workbook without error. I can press the button to create a file, it opens, and whether or not I close the file I can press the button again and it creates another file (and opens it).
Paul,
The file opens fine when I open it from were it´s saved, so it´s a mystery.
I guess I will have to try update adobe.
Thanks
Oeysbrei
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks