Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm currently working on a macro that is on a network (i.e. deals with the
Ne0x issue"), saves a pdf of a certain print area to the desktop, bypasses the "Save as" box of the non MS pdf writer (Doro PDF Writer), and names the file based on a cell reference. Whew! I've got everything working except the filename = cell reference Here's what is currently working if I wanted to just pick an arbitrary filename: ActiveSheet.ExportAsFixedFormat _ Type:=x1typepdf, _ Filename:="C:\Documents and Settings\all users\Desktop/test.pdf", _ Openafterpublish:=False I'm aware of the forward slash. For some reason, that's working. Anyway, this is what I thought would work: ActiveSheet.ExportAsFixedFormat _ Type:=x1typepdf, _ Filename:="C:\Documents and Settings\all users\Desktop/" _ & Range("A18").Value & ".pdf", _ Openafterpublish:=False But it's not. I get a run time error and a "File not Saved" notice. Btw, the line break in the filepath is only in this post because the message box isn't wide enough. Any help would be great. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Try to use a variable to build the file name string before the ExportAsFixedFormat statement. Dim PDFFileName As String PDFFileName = _ "C:\Documents and Settings\all users\Desktop/" _ & Range("A18").Value & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=x1typepdf, _ Filename:=PDFFileName, _ Openafterpublish:=False Hopes this helps. Regards, Per On 13 Nov., 22:50, Beric Dondarrion <Beric wrote: I'm currently working on a macro that is on a network (i.e. deals with the Ne0x issue"), saves a pdf of a certain print area to the desktop, bypasses the "Save as" box of the non MS pdf writer (Doro PDF Writer), and names the file based on a cell reference. Whew! I've got everything working except the filename = cell reference Here's what is currently working if I wanted to just pick an arbitrary filename: ActiveSheet.ExportAsFixedFormat _ * * * * Type:=x1typepdf, _ * * * * Filename:="C:\Documents and Settings\all users\Desktop/test.pdf", _ * * * * Openafterpublish:=False I'm aware of the forward slash. *For some reason, that's working. *Anyway, this is what I thought would work: ActiveSheet.ExportAsFixedFormat _ * * * * Type:=x1typepdf, _ * * * * Filename:="C:\Documents and Settings\all users\Desktop/" _ * * * * * & Range("A18").Value & ".pdf", _ * * * * Openafterpublish:=False But it's not. *I get a run time error and a "File not Saved" notice. *Btw, the line break in the filepath is only in this post because the message box isn't wide enough. Any help would be great. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell reference to determine filename | Excel Programming | |||
Cell reference to a filename | Excel Discussion (Misc queries) | |||
Cell("filename") doesn't update to new filename when do save as. | Excel Worksheet Functions | |||
how do u use a cell value for the save to filename | Excel Programming | |||
Save as .htm with filename from cell | Excel Discussion (Misc queries) |