ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File renaming doesn't work (https://www.excelbanter.com/excel-programming/389093-file-renaming-doesnt-work.html)

A. Karatas

File renaming doesn't work
 
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


Norman Jones

File renaming doesn't work
 
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
'<<=============


---
Regards,
Norman



"A. Karatas" wrote in message
ups.com...
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




Gary''s Student

File renaming doesn't work
 
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.
--
Gary''s Student - gsnu200720


"A. Karatas" wrote:

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



A. Karatas

File renaming doesn't work
 
Thankx guys. It's working



All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com