Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Unique filenames

Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it in a
second sheet as a report. This report also contains some fixed text and
simple graphics. The macro then prints the 'report' and goes back to the
first sheet for the next line of data ....... and so on. There are hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF format.

Thanks in anticipation.

Under Pressure
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Unique filenames

Hi

See if this can help you:

MyPath = "C:\Temp\"
MyFileName = "Report" & Range("A1").Value & ".pdf"

Sheets("Report").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & MyFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=
_
False

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it in a
second sheet as a report. This report also contains some fixed text and
simple graphics. The macro then prints the 'report' and goes back to the
first sheet for the next line of data ....... and so on. There are
hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF format.

Thanks in anticipation.

Under Pressure


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Unique filenames

Is this Excel 2007? It didn't work for me and I'm running 2003.

..ExportAsFixedFormat Type:=xlTypePDF

Eric

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Unique filenames

Yes it is Excel 2007, in previous versions, you have to install a PDF
writer, and then print the sheet using the PDF writer.

To save the sheet this should do it then:

MyPath = "C:\temp\"
MyFileName = "Report" & Range("A1").Value & ".xls"

Sheets("Report").SaveAs Filename:=MyPath & MyFileName

Regards,
Per



"EricG" skrev i meddelelsen
...
Is this Excel 2007? It didn't work for me and I'm running 2003.

.ExportAsFixedFormat Type:=xlTypePDF

Eric


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Unique filenames

Per

Thanks for the prompt reply.

I can't try your solution until I get to work tomorrow. However, I'm not
sure from your lines of code where abouts I need to store my unique
identifier. I'm also using Excel 2003 so presumably from the comment from
Eric, I'll need to have a go with your second post.

Thanks again

Under Pressure

"Per Jessen" wrote:

Hi

See if this can help you:

MyPath = "C:\Temp\"
MyFileName = "Report" & Range("A1").Value & ".pdf"

Sheets("Report").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & MyFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=
_
False

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it in a
second sheet as a report. This report also contains some fixed text and
simple graphics. The macro then prints the 'report' and goes back to the
first sheet for the next line of data ....... and so on. There are
hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF format.

Thanks in anticipation.

Under Pressure





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Unique filenames

Hi again,

In my example, I assumed the unique identifier is in A1 of activesheet. The
cell reference can be changed as desired. If the unique identifier is found
on another sheet, we have to use the sheet reference too:

MyFileName = "Report" & Sheets("Sheet1").Range("A1").Value & ".xls"

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Per

Thanks for the prompt reply.

I can't try your solution until I get to work tomorrow. However, I'm not
sure from your lines of code where abouts I need to store my unique
identifier. I'm also using Excel 2003 so presumably from the comment from
Eric, I'll need to have a go with your second post.

Thanks again

Under Pressure

"Per Jessen" wrote:

Hi

See if this can help you:

MyPath = "C:\Temp\"
MyFileName = "Report" & Range("A1").Value & ".pdf"

Sheets("Report").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & MyFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False,
OpenAfterPublish:=
_
False

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it
in a
second sheet as a report. This report also contains some fixed text
and
simple graphics. The macro then prints the 'report' and goes back to
the
first sheet for the next line of data ....... and so on. There are
hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied
onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF
format.

Thanks in anticipation.

Under Pressure




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Unique filenames


Thanks once again, Per

This appears to be working OK at present, I won't get chance to do the full
blown test until next monh.

You've saved me a great deal of time - again thanks!!!!!

Under Pressure

"Per Jessen" wrote:

Hi again,

In my example, I assumed the unique identifier is in A1 of activesheet. The
cell reference can be changed as desired. If the unique identifier is found
on another sheet, we have to use the sheet reference too:

MyFileName = "Report" & Sheets("Sheet1").Range("A1").Value & ".xls"

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Per

Thanks for the prompt reply.

I can't try your solution until I get to work tomorrow. However, I'm not
sure from your lines of code where abouts I need to store my unique
identifier. I'm also using Excel 2003 so presumably from the comment from
Eric, I'll need to have a go with your second post.

Thanks again

Under Pressure

"Per Jessen" wrote:

Hi

See if this can help you:

MyPath = "C:\Temp\"
MyFileName = "Report" & Range("A1").Value & ".pdf"

Sheets("Report").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & MyFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False,
OpenAfterPublish:=
_
False

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it
in a
second sheet as a report. This report also contains some fixed text
and
simple graphics. The macro then prints the 'report' and goes back to
the
first sheet for the next line of data ....... and so on. There are
hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied
onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF
format.

Thanks in anticipation.

Under Pressure




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Unique filenames

Per

Just to let you know that I have now completed this project at work and it
has worked a treat. Thanks again - you saved me a great deal of time.

I posted another query yesterday but it doesn't appear to have shown up in
the list of posts. I tried it again this morning and I still can't see it.
Have I done something wrong? I hope not as posting a new thread looks simple
enough.

Cheers

Under Pressure

"Per Jessen" wrote:

Hi again,

In my example, I assumed the unique identifier is in A1 of activesheet. The
cell reference can be changed as desired. If the unique identifier is found
on another sheet, we have to use the sheet reference too:

MyFileName = "Report" & Sheets("Sheet1").Range("A1").Value & ".xls"

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Per

Thanks for the prompt reply.

I can't try your solution until I get to work tomorrow. However, I'm not
sure from your lines of code where abouts I need to store my unique
identifier. I'm also using Excel 2003 so presumably from the comment from
Eric, I'll need to have a go with your second post.

Thanks again

Under Pressure

"Per Jessen" wrote:

Hi

See if this can help you:

MyPath = "C:\Temp\"
MyFileName = "Report" & Range("A1").Value & ".pdf"

Sheets("Report").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & MyFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False,
OpenAfterPublish:=
_
False

Regards,
Per

"Under Pressure" skrev i
meddelelsen ...
Here's a tricky one (for me anyway)

I have a macro that reads a line of data from a sheet and presents it
in a
second sheet as a report. This report also contains some fixed text
and
simple graphics. The macro then prints the 'report' and goes back to
the
first sheet for the next line of data ....... and so on. There are
hundreds
of rows in the sheet and therefore hundreds of printed reports.

OK so far?

What I would like to do is to save each of the 'reports' using a unique
reference taken from one of the cells in the row that has been copied
onto
the report.

Any ideas?

As an addition, it would be preferable to save the report in a PDF
format.

Thanks in anticipation.

Under Pressure




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
Generation of filenames correomaster Excel Programming 2 January 25th 07 02:16 PM
what do 'blue filenames' mean? Boswell Excel Discussion (Misc queries) 2 January 16th 07 05:36 PM
getting filenames jim9912 Excel Programming 3 March 30th 06 05:55 PM
unique filenames in macros [email protected] Excel Programming 1 September 7th 05 12:19 AM
Getting filenames via VBA Andrew Excel Programming 5 April 15th 05 12:41 PM


All times are GMT +1. The time now is 12:14 AM.

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

About Us

"It's about Microsoft Excel"