Save file with variant name from an input box

  • Thread starter Thread starter Tempy
  • Start date Start date
T

Tempy

Hi all,
I am getting a variant from an input box and want to use this varaint as
the file name?

I am a biginner an need some help with some code if possible please.

Tempy
 
Hi
without much error checking:
sub save_it()
Dim fname
fname = inputbox ("Enter a filename")
if fname <>"" then
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=fname
end if
end sub
 
You might want to use the built in dialogs for this

Dim fname as String
fname = Application.GetSaveAsFilename()
if fname <> "False" then
Activeworkbook.SaveAs fName
End if

This also allows the user to choose a location using the mouse.
 

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

Back
Top