Application.Dialogs(xlDialogSaveAs) = res ???

C

Corey

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....
 
L

Leith Ross

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
 

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

Top