View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default HOW DO I USE THE GETSAVEASFILENAME METHOD?

Dim myFileName As Variant

With ActiveWorkbook.Worksheets("Sheet1")
myFileName = "C:\my documents\excel\c" _
& .Range("A1").Value _
& .Range("b1").Value & ".xls"
End With

myFileName = Application.GetSaveAsFilename(InitialFileName:=myF ileName, _
filefilter:="Excel files,*.xls")

If myFileName = False Then
'user hit cancel
Exit Sub
End If


or maybe:

With ActiveWorkbook.Worksheets("Sheet1")
myFileName = "C:\my documents\excel\c" _
& format(.Range("A1").Value, "00000") _
& .Range("b1").Value & ".xls"
End With

if you have to format that number.


Mike wrote:

When using the InitialFilename argument, I would like to combine the contents
of several cells and a text constant to form the InitialFilename. For
example, I want the filename to be a string consisting of: "C" + "cell1" +
"cell2". If the contents of "cell1" are '50000' and "cell2" are the text
letter 'A', then the InitialFilename argument would be: C50000A.xls. What is
the code for this in Excel 2003 VBA?

Mike


--

Dave Peterson