File renaming doesn't work

A

A. Karatas

Hello,

I made the following code, which opens the Save As box. I then change
the dir, and want it to save it under the name given in cell AE2. But
it doesn't work. I am working with excel2000.

Any idea's why???????


Sub filerenaming()
fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:=Range("AE2").Value, _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
End If
End Sub
 
N

Norman Jones

Hi A,

The GetSaveAsFiolename method only provides
the user's name choice; it does not save the file.

Try something like:

'=============>>
Public Sub filerenaming()
Dim fileSaveName As Variant
fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:=Range("AE2").Value, _
FileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
If fileSaveName <> False Then
ActiveWorkbook.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If
End Sub
'<<=============
 
G

Guest

You are almost there. Missing only a single line:

Sub filerenaming()
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("AE2").Value, _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
If fileSaveName <> False Then
ActiveWorkbook.SaveAs Filename:=fileSaveName
MsgBox "Save as " & fileSaveName
End If
End Sub


The Msgbox was there but not the actual Save.
 

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

Similar Threads

Run Time Error on trying to save workbook 14
command button to save 1
Prompt for Save As Window through macro 7
Save As 2
Save As macro 2
Providing suggested filename 2
Workbook_BeforeSave() 3
SaveAs doesn't work 1

Top