ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Dialogs(xlDialogSaveAs) = res ??? (https://www.excelbanter.com/excel-programming/365596-application-dialogs-xldialogsaveas-%3D-res.html)

Corey

Application.Dialogs(xlDialogSaveAs) = res ???
 
res = InputBox("Enter a file name ? ", "Company Name here..")
If res = "" Then Exit Sub
ThisWorkbook.Save
With ActiveWorkbook
Worksheets(Array("A", "1")).Copy
Application.Dialogs(xlDialogSaveAs) = res <========= Error here
End With
End Sub


I get an error in the above.
How do i set res to be the new file name ?

Corey....






Norman Jones

Application.Dialogs(xlDialogSaveAs) = res ???
 
Hi Corey,

Try replacing:

Application.Dialogs(xlDialogSaveAs) = res


with

ActiveWorkbook.SaveAs Filename:=res & ".xls"


---
Regards,
Norman

"Corey" wrote in message
...
res = InputBox("Enter a file name ? ", "Company Name here..")
If res = "" Then Exit Sub
ThisWorkbook.Save
With ActiveWorkbook
Worksheets(Array("A", "1")).Copy
Application.Dialogs(xlDialogSaveAs) = res <========= Error here
End With
End Sub


I get an error in the above.
How do i set res to be the new file name ?

Corey....








Leith Ross[_610_]

Application.Dialogs(xlDialogSaveAs) = res ???
 

Hello Corey,

The SaveAs Dialog offered by Excel requires you manually enter the new
file name. It can't be assigned by a variable. Other options would
include the API SaveAs Dialog which does allow assignments through
variables or by using the FSO (File System Object) script.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=556329



All times are GMT +1. The time now is 03:58 AM.

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