Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Closing a workbook without saving

Hello Guys,
I'm about to go crazy, I'm trying to get a workbook to close, after
all the tasks I need done are finished, without saving. Normally this is
easy, ActiveWorkbook.Close False. However, that is not working for me.

Here is the sequence of events that are completed before the workbook
needs to close(all this is invoked by a command button):

1) The workbook is saved with the filename as the contents of a cell.
2) Then the workbook is attached to an email and sent off to three
people at the same time, using SendMail.
3) Then an input box pops up, and using what the user puts into that
box, which is going to be an email address, the workbook is attached and
sent out a second time.
4)Then I need the workbook to close without saving the changes. But
whatever I do, nothing works. I've tried not displaying the
alerts(Application.DisplayAlerts False), and nothing works. Here is a
scaled down version of my code(edited for sensitive info):

Private Sub CommandButton1_Click()
Dim File
File = Dir("C:\" & Worksheets("sheet1").Range"F9").Value _ & ".xls")
MyFile = "" Then
ActiveWorkbook.SaveAs Filename:="C:\" & Worksheets
_("sheet1").Range("F9").Value & ".xls"
End If
Dim usename
usename = Application.UserName & "
End If
'ActiveWorkbook.SendMail Array ",
, usename)
Range("F43:J43") = "XXXX-XXXX-XXXX-XXXX"
Dim resp, cname
cname = Range("D12")
resp = InputBox("What is the customer's Email ?", _
"Customer Copy")
ActiveWorkbook.SendMail (resp)
ThisWorkbook.Saved = True
ActiveWorkbook.Close (SaveChanges = "False")
End Sub

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Closing a workbook without saving

Without being able to test this, I think the offending line should just be

ActiveWorkbook.Close(False)

as it is it is missing a colon and should not be a string in quotes.

Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Darrin Henry" wrote in message
...
Hello Guys,
I'm about to go crazy, I'm trying to get a workbook to close, after
all the tasks I need done are finished, without saving. Normally this is
easy, ActiveWorkbook.Close False. However, that is not working for me.

Here is the sequence of events that are completed before the workbook
needs to close(all this is invoked by a command button):

1) The workbook is saved with the filename as the contents of a cell.
2) Then the workbook is attached to an email and sent off to three
people at the same time, using SendMail.
3) Then an input box pops up, and using what the user puts into that
box, which is going to be an email address, the workbook is attached and
sent out a second time.
4)Then I need the workbook to close without saving the changes. But
whatever I do, nothing works. I've tried not displaying the
alerts(Application.DisplayAlerts False), and nothing works. Here is a
scaled down version of my code(edited for sensitive info):

Private Sub CommandButton1_Click()
Dim File
File = Dir("C:\" & Worksheets("sheet1").Range"F9").Value _ & ".xls")
MyFile = "" Then
ActiveWorkbook.SaveAs Filename:="C:\" & Worksheets
_("sheet1").Range("F9").Value & ".xls"
End If
Dim usename
usename = Application.UserName & "
End If
'ActiveWorkbook.SendMail Array ",
, usename)
Range("F43:J43") = "XXXX-XXXX-XXXX-XXXX"
Dim resp, cname
cname = Range("D12")
resp = InputBox("What is the customer's Email ?", _
"Customer Copy")
ActiveWorkbook.SendMail (resp)
ThisWorkbook.Saved = True
ActiveWorkbook.Close (SaveChanges = "False")
End Sub

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Closing a workbook without saving

Thanks, I feel so stupid I tried changing all different things around
and nothing worked.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Saving and closing erf Setting up and Configuration of Excel 4 June 18th 08 06:52 PM
Saving and Closing erf Excel Worksheet Functions 3 June 18th 08 05:03 PM
Saving and Closing erf Excel Discussion (Misc queries) 1 June 18th 08 08:38 AM
closing & saving rufusf Excel Worksheet Functions 2 March 5th 06 09:37 AM
Closing Excel without saving Abs Excel Discussion (Misc queries) 9 December 7th 05 03:10 PM


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