Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel DisplayAlerts
Message
From
06/07/2011 13:42:40
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
05/07/2011 15:30:04
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01517330
Message ID:
01517460
Views:
45
We have a custom class, cusExcel, that wraps an Excel object. When we call various methods we set (reset) DisplayAlerts because it does set itself to .T. at times. At least with Office 2007.
CreateExcel()
LOCAL RetVal
IF TYPE('This.oExcel') # 'O' AND NOT ISNULL(This.oExcel)
This.oExcel = CREATEOBJECT('Excel.Application')
ENDIF
IF TYPE("This.oExcel") = 'O' AND NOT ISNULL(This.oExcel)
RetVal = .T.
This.oExcel.DisplayAlerts = .F.
ENDIF
RETURN m.RetVal

Hide()
This.oExcel.Visible = .F.
This.oExcel.DisplayAlerts = .F.

AsSave()
...
IF This.oExcel.Visible
This.oExcel.DisplayAlerts = This.DisplayAlerts
ELSE
This.oExcel.DisplayAlerts = .F.
ENDIF
....

Close()
IF .oExcel.Visible
.oExcel.DisplayAlerts = .DisplayAlerts
ELSE
.DisplayAlerts = .F. && DisplayAlerts can get reset.
ENDIF
....

Save()
....
IF .Visible
.DisplayAlerts = This.DisplayAlerts
ELSE
.DisplayAlerts = .F. && DisplayAlerts can get reset.
ENDIF
...

This seems to control the DisplayAlerts fine.
Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform