Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Canceling SaveAs dialog box without saving workbook

Please Help!!!!

Problem: I prompt the user it they would like to save the document. If they select Yes then the SaveAs dialog box appears. But if they click the Cancel button on the SaveAs dialog box, it saves the document anyway as "False". How do I return to my code and just resume the next command or event?????


Here's the code that I am using:

saveanswer=msgbox ("Would you like to save?", vbyesno)

If saveanswer=vbyes then
FileSaveName = Application.GetSaveAsFilename(fileFilter:"Microsof t Excel File (*.xls),*.xls")

ActiveWorkbook.SaveAs (FileSaveName)

Elseif saveanswer = vbcancel then
UserForm2.show
End If



Thanks In Advance
€” CDotWin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Canceling SaveAs dialog box without saving workbook

You have to test the return from GetSaveAsFileName

saveanswer = MsgBox("Would you like to save?", vbYesNo)

If saveanswer = vbYes Then
filesavename = Application.GetSaveAsFilename(fileFilter:="Microso ft
Excel File (*.xls),*.xls")

If filesavename < "False" Then
ActiveWorkbook.SaveAs (filesavename)
End If

Else
UserForm2.Show
End If

Also, vbYesNo MsgBox cannot retuirn vbCancel

--

HTH

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

"CDotWin" wrote in message
...
Please Help!!!!

Problem: I prompt the user it they would like to save the document. If

they select Yes then the SaveAs dialog box appears. But if they click the
Cancel button on the SaveAs dialog box, it saves the document anyway as
"False". How do I return to my code and just resume the next command or
event?????


Here's the code that I am using:

saveanswer=msgbox ("Would you like to save?", vbyesno)

If saveanswer=vbyes then
FileSaveName = Application.GetSaveAsFilename(fileFilter:"Microsof t

Excel File (*.xls),*.xls")

ActiveWorkbook.SaveAs (FileSaveName)

Elseif saveanswer = vbcancel then
UserForm2.show
End If



Thanks In Advance
- CDotWin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Canceling SaveAs dialog box without saving workbook

Even when I put in the code to test the filesavename, it continues to save . as "FALSE.xls". I dont know why its still doing that and how to fix it. Please help.

"Bob Phillips" wrote:

You have to test the return from GetSaveAsFileName

saveanswer = MsgBox("Would you like to save?", vbYesNo)

If saveanswer = vbYes Then
filesavename = Application.GetSaveAsFilename(fileFilter:="Microso ft
Excel File (*.xls),*.xls")

If filesavename < "False" Then
ActiveWorkbook.SaveAs (filesavename)
End If

Else
UserForm2.Show
End If

Also, vbYesNo MsgBox cannot retuirn vbCancel

--

HTH

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

"CDotWin" wrote in message
...
Please Help!!!!

Problem: I prompt the user it they would like to save the document. If

they select Yes then the SaveAs dialog box appears. But if they click the
Cancel button on the SaveAs dialog box, it saves the document anyway as
"False". How do I return to my code and just resume the next command or
event?????


Here's the code that I am using:

saveanswer=msgbox ("Would you like to save?", vbyesno)

If saveanswer=vbyes then
FileSaveName = Application.GetSaveAsFilename(fileFilter:"Microsof t

Excel File (*.xls),*.xls")

ActiveWorkbook.SaveAs (FileSaveName)

Elseif saveanswer = vbcancel then
UserForm2.show
End If



Thanks In Advance
- CDotWin




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Canceling SaveAs dialog box without saving workbook

I have just tried it again, and I don't get that result.

have you stepped through the code?

--

HTH

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

"CDotWin" wrote in message
...
Even when I put in the code to test the filesavename, it continues to save

.. as "FALSE.xls". I dont know why its still doing that and how to fix it.
Please help.

"Bob Phillips" wrote:

You have to test the return from GetSaveAsFileName

saveanswer = MsgBox("Would you like to save?", vbYesNo)

If saveanswer = vbYes Then
filesavename = Application.GetSaveAsFilename(fileFilter:="Microso ft
Excel File (*.xls),*.xls")

If filesavename < "False" Then
ActiveWorkbook.SaveAs (filesavename)
End If

Else
UserForm2.Show
End If

Also, vbYesNo MsgBox cannot retuirn vbCancel

--

HTH

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

"CDotWin" wrote in message
...
Please Help!!!!

Problem: I prompt the user it they would like to save the document.

If
they select Yes then the SaveAs dialog box appears. But if they click

the
Cancel button on the SaveAs dialog box, it saves the document anyway as
"False". How do I return to my code and just resume the next command or
event?????


Here's the code that I am using:

saveanswer=msgbox ("Would you like to save?", vbyesno)

If saveanswer=vbyes then
FileSaveName =

Application.GetSaveAsFilename(fileFilter:"Microsof t
Excel File (*.xls),*.xls")

ActiveWorkbook.SaveAs (FileSaveName)

Elseif saveanswer = vbcancel then
UserForm2.show
End If



Thanks In Advance
- CDotWin






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
Can you Pre-fill file name in SaveAs dialog Jive Excel Worksheet Functions 1 November 12th 07 04:30 PM
SaveAs dialog Gary''s Student Excel Discussion (Misc queries) 2 February 23rd 06 03:11 PM
Method SaveAs with no overwrite YesNoCancel dialog Peter Pham Excel Programming 1 July 16th 04 09:28 PM
Can't get Excel SaveAs dialog to show mjoe Excel Programming 4 May 7th 04 04:18 AM
SaveAs Dialog Arguments Frank Kabel Excel Programming 4 February 24th 04 07:25 PM


All times are GMT +1. The time now is 09:09 PM.

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"