Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Default SaveAs type...

Hello All,

I have a macro that imports a text file, does some manipulations and, in the
end, displays the SaveAs dialog box. The default "Save as type" is "Text(Tab
Delimited)". However, the user is always going to want this changed to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

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

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an existing
file, the default format is the last file format specified; for a new file,
the default is the format of the version of Excel being used. ... so it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations and, in

the
end, displays the SaveAs dialog box. The default "Save as type" is

"Text(Tab
Delimited)". However, the user is always going to want this changed to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Default SaveAs type...

Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an existing
file, the default format is the last file format specified; for a new file,
the default is the format of the version of Excel being used. ... so it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations and, in

the
end, displays the SaveAs dialog box. The default "Save as type" is

"Text(Tab
Delimited)". However, the user is always going to want this changed to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Default SaveAs type...

Jesterhoz,
Unless anyone can help you control Excel's dialog, you could use the API
route and only give .xls as a possible format.
Check out the GetSaveFileName api.

NickHK

"Jesterhoz" wrote in message
...
Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a

folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an

existing
file, the default format is the last file format specified; for a new

file,
the default is the format of the version of Excel being used. ... so it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations and,

in
the
end, displays the SaveAs dialog box. The default "Save as type" is

"Text(Tab
Delimited)". However, the user is always going to want this changed

to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft

Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor






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

GetSaveAsFileName (not GetSaveFileName) is a method not an API. There is
equivalent APIs, but they are much more complex to implement.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"NickHK" wrote in message
...
Jesterhoz,
Unless anyone can help you control Excel's dialog, you could use the API
route and only give .xls as a possible format.
Check out the GetSaveFileName api.

NickHK

"Jesterhoz" wrote in message
...
Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a

folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an

existing
file, the default format is the last file format specified; for a new

file,
the default is the format of the version of Excel being used. ... so

it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations

and,
in
the
end, displays the SaveAs dialog box. The default "Save as type" is
"Text(Tab
Delimited)". However, the user is always going to want this changed

to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft

Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Default SaveAs type...

Bob,
I did intend the API route rather than the built-in version, as it's what I
am used to.
Granted the built-in may be less involved.

NickHK

"Bob Phillips" wrote in message
...
GetSaveAsFileName (not GetSaveFileName) is a method not an API. There is
equivalent APIs, but they are much more complex to implement.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"NickHK" wrote in message
...
Jesterhoz,
Unless anyone can help you control Excel's dialog, you could use the API
route and only give .xls as a possible format.
Check out the GetSaveFileName api.

NickHK

"Jesterhoz" wrote in message
...
Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a

folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an

existing
file, the default format is the last file format specified; for a

new
file,
the default is the format of the version of Excel being used. ...

so
it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations

and,
in
the
end, displays the SaveAs dialog box. The default "Save as type"

is
"Text(Tab
Delimited)". However, the user is always going to want this

changed
to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft

Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Default SaveAs type...

Use
Dim sName as String, fName as String
sName = activeworkbook.name
sName = left(sName,len(sName)-4) & ".xls"
fName = Application.GetSaveAsFilename(InitialFilename:=sNa me, _
filefilter:="xls Files (*.xls), *.xls")
if fName < "False" then
activeworkbook.SaveAs fName, xlWorkbookNormal
else
msgbox "You clicked cancel"
exit sub
End if

GetSaveAsFilename puts up the same dialog, but only returns the fully
qualified filename selected. You then do the save, having full control of
the format.

--
Regards,
Tom Ogilvy




"Jesterhoz" wrote in message
...
Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a

folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an

existing
file, the default format is the last file format specified; for a new

file,
the default is the format of the version of Excel being used. ... so it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations and,

in
the
end, displays the SaveAs dialog box. The default "Save as type" is

"Text(Tab
Delimited)". However, the user is always going to want this changed

to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft

Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Default SaveAs type...

Much obliged, gentlemen. Your suggestions worked like a charm.

Thanks.

"Tom Ogilvy" wrote:

Use
Dim sName as String, fName as String
sName = activeworkbook.name
sName = left(sName,len(sName)-4) & ".xls"
fName = Application.GetSaveAsFilename(InitialFilename:=sNa me, _
filefilter:="xls Files (*.xls), *.xls")
if fName < "False" then
activeworkbook.SaveAs fName, xlWorkbookNormal
else
msgbox "You clicked cancel"
exit sub
End if

GetSaveAsFilename puts up the same dialog, but only returns the fully
qualified filename selected. You then do the save, having full control of
the format.

--
Regards,
Tom Ogilvy




"Jesterhoz" wrote in message
...
Thanks for responding, Bob.

I only have one concern, though. I am using the following:

Application.Dialogs(xlDialogSaveAs).Show

This opens the SaveAs Dialog box and allows the user to navigate to a

folder
of choice and save the file with whatever name they choose. How can I
incorporate the FileFormat property into this call?

Thanks,

Trevor

"Bob Phillips" wrote:

Trevor,

SaveAs has a FileFormat property. However, the help says ... For an

existing
file, the default format is the last file format specified; for a new

file,
the default is the format of the version of Excel being used. ... so it
should default to Excel file. If you want to force it, set it to
xlWorkbookNormal.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jesterhoz" wrote in message
...
Hello All,

I have a macro that imports a text file, does some manipulations and,

in
the
end, displays the SaveAs dialog box. The default "Save as type" is
"Text(Tab
Delimited)". However, the user is always going to want this changed

to
"Microsoft Excel Workbook".

Does anyone know how to change the "Save as type" to be "Microsoft

Excel
Workbook" using VBA?

Any help would be much appreciated.

Thanks,

Trevor






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Default SaveAs type...

Hello,

See the VBE file for GetSaveAsFilename Method.

http://msdn.microsoft.com/library/en...HV05201563.asp

Regards,
Nate Oliver
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
SaveAs wk3 file type error message Ken Warthen[_2_] Excel Discussion (Misc queries) 1 December 9th 09 10:42 PM
How do I set default Excel Saveas file format to xlsx not xlsx Greg Conway Setting up and Configuration of Excel 1 September 17th 08 04:19 PM
Default reference type [email protected] Excel Discussion (Misc queries) 3 October 11th 06 06:35 PM
Default to SaveAs Bob Phillips[_6_] Excel Programming 0 June 25th 04 05:24 PM
Default recordset type? -\) Excel Programming 3 July 23rd 03 09:16 AM


All times are GMT +1. The time now is 01:12 AM.

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

About Us

"It's about Microsoft Excel"