Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro Save with Worksheet as file Name

Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the saving
to pdf part down, but I can't seem to get the renaming of the filename to the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Macro Save with Worksheet as file Name

This is one that I use to save
In the original PNT031 sheet in A8 is =TODAY()
which is formatted to read each day ( 2006 Oct 19 )....
you can have the name of your worksheet in "A8
then between the " " put the path in.



Sub SvePNT031()
Dim strFileName As String
Sheets("PNT031").Activate
strFileName = Range("A8").Text
ActiveWorkbook.SaveAs Filename:="F:\Auditors.QA
references\2ndShift\JKPNT031\" & strFileName & ".xls"
ActiveWorkbook.Close
End Sub

"bbkixx" wrote:

Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the saving
to pdf part down, but I can't seem to get the renaming of the filename to the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Macro Save with Worksheet as file Name

Name "OldFileName.pdf" As "Newfilename.pdf"
Add the path as required.

NickHK

"bbkixx" ...
Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the
saving
to pdf part down, but I can't seem to get the renaming of the filename to
the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Macro Save with Worksheet as file Name

strFilename = "C:\YourPath\" & ActiveSheet.Name & ".YourExtension"
--
Charles Chickering

"A good example is twice the value of good advice."


"bbkixx" wrote:

Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the saving
to pdf part down, but I can't seem to get the renaming of the filename to the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro Save with Worksheet as file Name

I don't know how to SaveAs pdf, but the following will SaveAs the sheet or
(tab) name:


Sub Macro1()
Dim s As String
s = ActiveCell.Worksheet.Name
ActiveWorkbook.SaveAs Filename:=s
End Sub

You do not need to spec. the directory if you are willing to save back from
whence you came.
--
Gary's Student


"bbkixx" wrote:

Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the saving
to pdf part down, but I can't seem to get the renaming of the filename to the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro Save with Worksheet as file Name

WOW, thank you everyone for the responses. Everything is working very
smoothly now!

BBkixx

"Gary''s Student" wrote:

I don't know how to SaveAs pdf, but the following will SaveAs the sheet or
(tab) name:


Sub Macro1()
Dim s As String
s = ActiveCell.Worksheet.Name
ActiveWorkbook.SaveAs Filename:=s
End Sub

You do not need to spec. the directory if you are willing to save back from
whence you came.
--
Gary's Student


"bbkixx" wrote:

Hello-

I am trying to create a macro that will save a worksheet as a pdf, and
rename the file to the name of the selected worksheet. Now I have the saving
to pdf part down, but I can't seem to get the renaming of the filename to the
worksheet part down. Does anyone have some ideas how I can do this?

Any help will be greatly apperciated.

Thank you!
BBkixx

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
macro save a file name from a cell in 1st worksheet karene Excel Discussion (Misc queries) 2 April 10th 06 12:13 PM
file size after using macro to save a worksheet BigPig Excel Programming 2 March 10th 06 02:03 AM
How do I set up a macro to save an Excel worksheet as a .prn file? cher Excel Programming 2 March 1st 06 03:50 PM
Macro to export a worksheet and save as new file Mike_M Excel Programming 2 May 25th 05 10:37 AM
using macro to save worksheet with unique file name Noell Excel Programming 3 October 15th 03 10:24 PM


All times are GMT +1. The time now is 04:40 PM.

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"