Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default SaveAs Dialog Arguments

Hi
try

fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:="Dummy.xls", _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If

to set the initial name and the filetype


--
Regards
Frank Kabel
Frankfurt, Germany

Matt wrote:
I would like to set the default settings on a SaveAs Dialog box. I
have the code to set the default file SaveAs name. I would like to
also set the file type and the location. For instance, I would like
to set the default SaveAs location as my C: drive and the file type
as Excel Workbook. Here is what I have so far. Thanks. Matt

Application.Dialogs(xlDialogSaveAs).Show (fileToOpen)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default SaveAs Dialog Arguments

Matt,

For the location, do a

ChDir "C:\"

before the GetSaveAsFilename

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
try

fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:="Dummy.xls", _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If

to set the initial name and the filetype


--
Regards
Frank Kabel
Frankfurt, Germany

Matt wrote:
I would like to set the default settings on a SaveAs Dialog box. I
have the code to set the default file SaveAs name. I would like to
also set the file type and the location. For instance, I would like
to set the default SaveAs location as my C: drive and the file type
as Excel Workbook. Here is what I have so far. Thanks. Matt

Application.Dialogs(xlDialogSaveAs).Show (fileToOpen)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default SaveAs Dialog Arguments

fileToOpen is the name of my file. Where would I put this in the code that you gave me? Thanks. Matt
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default SaveAs Dialog Arguments

Hi Matt
to put everything together use:

Sub foo()
Dim fileSaveName
Dim path as string
.....
ChDir "C:\"
fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:=fileToOpen, _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
....
end sub


--
Regards
Frank Kabel
Frankfurt, Germany

Matt wrote:
fileToOpen is the name of my file. Where would I put this in the
code that you gave me? Thanks. Matt

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default SaveAs Dialog Arguments

Hi Matt
first question: Your current drive is not C:? So you may change the
code to
Sub foo()
Dim fileSaveName
Dim path as string
.....
ChDrive "C:"
ChDir "C:\"
fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:=fileToOpen, _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
....
end sub

The lines
If fileSaveName < false then
msgbox " Save as " & fileSaveName
end if

are just 'dummy code'. The If clause checks if you have pressed 'OK' in
the dialog and if this is true displays the filename (without doing
anything else). You have to adapt these lines to your specific needs
(save the file, etc.)




--
Regards
Frank Kabel
Frankfurt, Germany

Matt wrote:
Thanks Frank. I have a couple of questions. What does the following
do?
If fileSaveName < false then
msgbox " Save as " & fileSaveName
end if

Also, when I put in the ChDir "C:\" it changes it to lowercase. Is
this normal? Even with this in the code, it doesn't seem to work
right. It still goes back to the last accessed directory. Thanks
for your help. Matt


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function Arguments dialog vanishes when clicked an inserted shape RK Excel Worksheet Functions 2 February 2nd 09 07:58 AM
Can you Pre-fill file name in SaveAs dialog Jive Excel Worksheet Functions 1 November 12th 07 04:30 PM
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
SaveAs dialog Gary''s Student Excel Discussion (Misc queries) 2 February 23rd 06 03:11 PM
Sort Dialog Arguments Dirk Kampfmeier Excel Programming 1 October 21st 03 01:49 PM


All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"