Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default SaveAs command doesn't save extension

I am trying to pull a SaveAs dialog box from a VB command that will
prompt the user to save their work. The problem is when the user
types in the filename it does not save as an excel file. The user
would have to type the extension themselves and that is not feasible
for this application. Below is the code I got from VB Help. Is there
another way?


sub savenew()
Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
NewBook.SaveAs Filename:=fName
end sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default SaveAs command doesn't save extension

Hi Stewart,

Try:

NewBook.SaveAs Filename:=fName & "xls", _
FileFormat:=xlWorkbookNormal

---
Regards,
Norman



"stewart" wrote in message
oups.com...
I am trying to pull a SaveAs dialog box from a VB command that will
prompt the user to save their work. The problem is when the user
types in the filename it does not save as an excel file. The user
would have to type the extension themselves and that is not feasible
for this application. Below is the code I got from VB Help. Is there
another way?


sub savenew()
Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
NewBook.SaveAs Filename:=fName
end sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default SaveAs command doesn't save extension

Hi Stewart,

Better would be:

'=============
Sub Savenew()
Dim NewBook As Workbook
Dim fName As Variant

Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename _
(fileFilter:="Excel Files (*.xls), *.xls")

Loop Until fName < False
NewBook.SaveAs Filename:=fName, _
FileFormat:=xlWorkbookNormal
End Sub
'<<=============


---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default SaveAs command doesn't save extension

Try this:

Sub savenew()
Dim NewBook As Workbook
Dim fname As String
Set NewBook = Workbooks.Add
Do
fname = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

Loop Until fname < ""
NewBook.SaveAs Filename:=fname
End Sub


Mike F
"stewart" wrote in message
oups.com...
I am trying to pull a SaveAs dialog box from a VB command that will
prompt the user to save their work. The problem is when the user
types in the filename it does not save as an excel file. The user
would have to type the extension themselves and that is not feasible
for this application. Below is the code I got from VB Help. Is there
another way?


sub savenew()
Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
NewBook.SaveAs Filename:=fName
end sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default SaveAs command doesn't save extension

Thank you for all your help. I used Normans suggestion and it did the
trick.

On Apr 8, 9:35 am, "Norman Jones"
wrote:
Hi Stewart,

Better would be:

'=============
Sub Savenew()
Dim NewBook As Workbook
Dim fName As Variant

Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename _
(fileFilter:="Excel Files (*.xls), *.xls")

Loop Until fName < False
NewBook.SaveAs Filename:=fName, _
FileFormat:=xlWorkbookNormal
End Sub
'<<=============

---
Regards,
Norman



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
Default Save Extension ---Fitz--- Excel Discussion (Misc queries) 0 July 22nd 08 06:07 PM
Save Extension Jason Zischke Excel Programming 3 October 18th 06 03:09 AM
disable save and saveas from menubar and save via command button Steve E Excel Programming 5 September 13th 06 11:51 PM
auto save with variable name with html extension Jason[_29_] Excel Programming 0 May 25th 04 03:40 AM


All times are GMT +1. The time now is 10:41 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"