michelle_branch
asked on
Force Excel workbook to close without need to save a copy
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!!!!
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!!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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"
>>"if objExcel is your excel application object then " i mean i am supposing the object name you are using in your program is "objExcel"
ASKER
I
ASKER
I put..
Dim myapp As New excel.Application
Dim myWB As excel.Workbook
Dim myWS As excel.Worksheet
Set myWB = myapp.Workbooks.Open("c:\D iode_Temp\ Diodelog.x ls")
Set myWS = myWB.Sheets(Diodelog)
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuo te, _
ConsecutiveDelimiter:=Fals e, 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..
Dim myapp As New excel.Application
Dim myWB As excel.Workbook
Dim myWS As excel.Worksheet
Set myWB = myapp.Workbooks.Open("c:\D
Set myWS = myWB.Sheets(Diodelog)
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuo
ConsecutiveDelimiter:=Fals
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..
try this
Dim myapp As New excel.Application
Dim myWB As excel.Workbook
Dim myWS As excel.Worksheet
Set myWB = myapp.Workbooks.Open("c:\D iode_Temp\ Diodelog.x ls")
Set myWS = myWB.Sheets(Diodelog)
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuo te, _
ConsecutiveDelimiter:=Fals e, 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
Dim myapp As New excel.Application
Dim myWB As excel.Workbook
Dim myWS As excel.Worksheet
Set myWB = myapp.Workbooks.Open("c:\D
Set myWS = myWB.Sheets(Diodelog)
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuo
ConsecutiveDelimiter:=Fals
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
ASKER
now i got it..
i thought ur coding is "If..Then" statement.. that's why it didn't work.
now it works fine. thanks
i thought ur coding is "If..Then" statement.. that's why it didn't work.
now it works fine. thanks
ASKER
"?
sorryy.. i'm kindda slow.. :)