Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save a pdf to the desktop with a filename as a cell reference

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Save a pdf to the desktop with a filename as a cell reference

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell reference to determine filename Jacob Skaria Excel Programming 0 June 5th 09 03:05 PM
Cell reference to a filename Stevep4 Excel Discussion (Misc queries) 10 January 14th 09 10:30 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
how do u use a cell value for the save to filename mark/[email protected] Excel Programming 1 January 19th 06 07:43 PM
Save as .htm with filename from cell galimi Excel Discussion (Misc queries) 1 May 13th 05 04:51 AM


All times are GMT +1. The time now is 01:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"