?
Solved

Force Excel workbook to close without need to save a copy

Posted on 2003-11-30
7
Medium Priority
?
567 Views
Last Modified: 2010-05-03
Hi All..
i open an excel workbook using VB and modify some data in the excel sheet.
when i use command to close thhe workbook.. exel application will ask me whether i want to save the document or not..

How i want to force the excel workbook to close without i need to confirm whether i want to save it or not?
Meaning that, the excel will close without save a copy automatically when i click close button in my VB.

thanks a lot!!!!
0
Comment
Question by:michelle_branch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 39

Accepted Solution

by:
appari earned 150 total points
ID: 9847604
just before closing the excel add this line.

if objExcel is your excel application object then

objExcel.DisplayAlerts = False
0
 

Author Comment

by:michelle_branch
ID: 9847682
can mr appari give more details? what u mean by this "if objExcel is your excel application object then
"?

sorryy.. i'm kindda slow.. :)
0
 
LVL 39

Expert Comment

by:appari
ID: 9848120
can you post your code.

>>"if objExcel is your excel application object then " i mean i am supposing the object name you are using in your program is "objExcel"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:michelle_branch
ID: 9848156
I
0
 

Author Comment

by:michelle_branch
ID: 9848195
I put..

Dim myapp As New excel.Application  
Dim myWB As excel.Workbook  
Dim myWS As excel.Worksheet

Set myWB = myapp.Workbooks.Open("c:\Diode_Temp\Diodelog.xls")
Set myWS = myWB.Sheets(Diodelog)

Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, _
Comma:=False, Space:=True, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True

Tm = myWS.Range("A1").Value
MsgBox Tm

myWB.Close      
Set myWB = Nothing
myapp.Quit  
Set myapp = Nothing


~something like this..
0
 
LVL 39

Expert Comment

by:appari
ID: 9848233
try this


Dim myapp As New excel.Application  
Dim myWB As excel.Workbook  
Dim myWS As excel.Worksheet

Set myWB = myapp.Workbooks.Open("c:\Diode_Temp\Diodelog.xls")
Set myWS = myWB.Sheets(Diodelog)

Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, _
Comma:=False, Space:=True, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True

Tm = myWS.Range("A1").Value
MsgBox Tm

'*************** THIS IS ADDED BY ME
myapp.DisplayAlerts=false

myWB.Close      
Set myWB = Nothing
myapp.Quit  
Set myapp = Nothing


0
 

Author Comment

by:michelle_branch
ID: 9848237
now i got it..
i thought ur coding is "If..Then" statement.. that's why it didn't work.

now it works fine. thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question