View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Saving a variable filename

Anything wrong with your previous post...?


Dim flToSave As String
Dim flName As String
Dim flFormat As Long

flFormat = ActiveWorkbook.FileFormat
flName = ActiveSheet.Range("A1").Text & ".xls"

'If it is same as the current workbook
flToSave = ActiveWorkbook.Path
OR
'If it is a different path assign to that variable
flToSave = "m:\contract"

ActiveWorkbook.SaveAs flToSave & "\" & flName, flFormat
OR
ActiveWorkbook.SaveCopyAs flToSave & "\" & flName



If this post helps click Yes
---------------
Jacob Skaria


"Wes_A" wrote:

Good day all
I am trying to write a MACRO in Excel 2007 running on XP to automate a file
save as follows:
I want to save the currently active worksheet as a new workbook *.xls or
*.xlsb where €ś*€ť is a volatile filename contained in a cell on the currently
active worksheet, e.g. €śSeptember€ť, €śOctober€ť €¦.
Can anyone help with the code?
Regards
Wes_A