View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Help with SaveAs prompt

first msgbox won't return a string that you can use.

Maybe you could use:

Dim myFileName as String
myfileName = inputbox(Prompt:="What's the name?")

if trim(myname)="" then
exit sub
end if

....

ActiveWorkbook.SaveAs Filename:="H:\CMM REPORTS\V125D0\SHOES\Cavities\" _
myfilename & ".xls", _
FileFormat:=xlText, CreateBackup:=False

=======

Even better you may want to look at application.getsaveasfilename:


Dim myFileName As Variant

myFileName = "H:\CMM REPORTS\V125D0\SHOES\Cavities\suggestednamehere.xl s"

myFileName = Application.GetSaveAsFilename(InitialFileName:=myF ileName, _
filefilter:="Excel files,*.xls")

If myFileName = False Then
'user hit cancel
Exit Sub
End If

juggler wrote:

Greetings and Happy New Year,
I have been perusing this forum the last few weeks trying to
address a specific problem. I have used the search function and found a
lot of good information, but nothing that addresses my requirements.
I am trying to find an efficient way to 1) prompt a user to enter
a file designation and 2) save the file in a specific folder. This is
the code I've written so far, minus all the steps leading to the
prompt...

ActiveWindow.SelectedSheets.PrintPreview

Dim Message, Title, Default, NAME
Message = "Enter the SHOE number(s) to identify the folder" 'Set
prompt
Title = "Folder Identification" 'Set Title
Default = "Latest Inspection" ' Set Default
'Display message, title, and default values.
NAME = InputBox(Message, Title, Default)

ChDir "H:\CMM REPORTS"
ActiveWorkbook.SaveAs Filename:="H:\CMM
REPORTS\V125D0\SHOES\Cavities\(NAME).xls", _
FileFormat:=xlText, CreateBackup:=False

I thought that by placing (NAME) in the SaveAs string that it would
take the information from the Message Box and input it to the Filename,
but that is not the case. Any suggestions?
Some interesting weather here in New England, this first working day
of ' 06....hope y'all are staying warm.


--

Dave Peterson