Macro Save with Worksheet as file Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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.
 
WOW, thank you everyone for the responses. Everything is working very
smoothly now!

BBkixx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top