Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need some help with a macro,
I need it to saveas a file with the exact name as the contents of a specific cell,
eg cell a1 = 02.02.03.sun.xls
i need the macro to saveas the file as 02.02.03.sun.xlsany ideas,
i saw a post here a while ago similar but cant find it and really need to get this to work.
thanks
Adrian

When I need macros like that, I fire up the macro recorder, perform the action, then edit the result.
For example, in my typical export sub-routine, I have something like:
*************************************
sheets(sheet_to_export).copy
outfilename = worksheets(sheetname).rows(cellrow).columns(cellcolumn)
ActiveWorkbook.SaveAs FileName:= filename, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=FalseActiveWindow.Close
************************************
I didn't read-to-find-out any of that: I recorded a macro that did it, then edited it.
Don't expect to copy and paste that as a whole working piece of code: that is the concept and just one way of doing it.
I use Excel 97 and VBA.
How do you export multiple sheets at once? Start the macro recorder, select several sheets, move them, save them, close the result, stop macro recording, and hunt down the macro you created - it'll show you how.

Hey, try using this code:
ActiveWorkbook.SaveAs _
(ActiveSheet.Cells(1, 1).Text)This saves the current workbook named as the contents of cell A1. Note, though, that this saves the file to the current path. You can display the path by using
MsgBox ActiveWorkbook.Path
Post back or e-mail directly if this does/does not help or if you need further assistance.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |