Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / March 2004

Tip: Looking for answers? Try searching our database.

Macro - File Save As

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tucopup - 30 Mar 2004 23:54 GMT
I made a button at the end of a form.  The button should save th
workbook named for a unique identifier in a cell contained within th
workbook...MACRO HELP

If I could just record, it would be save as = to cell $b$14...but i
ain't that easy...is it

--
Message posted from http://www.ExcelForum.com
I.T. - 01 Apr 2004 00:02 GMT
Not sure exactly what you mean but this will get the filename from a
cell then open the save as dialog to specify the filepath (Filename can
still be altered prior to saving)

Dim xlsfname, xlsfpath As String
Sheets("Macro Help").Select
xlsfname = Worksheets("Macro Help").Range("B14").Value
xlsfpath = Application.GetSaveAsFilename(xlsfname, _
FileFilter:="Excel Files (*.xls),*.xls", FilterIndex:=1, _
Title:="Select Save location")
If xlsfpath = "False" Or xlsfpath = "" Then
End
End If
ActiveWorkbook.SaveAs FileName:=xlsfpath

Alternatively you can get the current directory in a particular cell
using

=INFO("directory") in another cell (Say B13) with the filename in
another cell (Say B14) then use

Dim xlsfname As String
Sheets("Macro Help").Select
xlsfname = Worksheets("Macro Help").Range("B13").Value & _
Worksheets("Macro Help").Range("B14").Value
ActiveWorkbook.SaveAs FileName:=xlsfname

This of course could be shortened into one continuous line without the
need for the xlsfname variable.

---
Message posted from http://www.ExcelForum.com/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.