Suppressing EXCEL modal boxes through OLE 
Author Message
 Suppressing EXCEL modal boxes through OLE

My vb4 app calls a VBA macro in an excel spreadsheet to create sub-totals.
 The excel function subtotal generates a modal box which I can't suppress
from vb.  The Sendkeys statement and methods used either in the vb
calling app or in the EXCEL macro won't suppress it.  I have to manually
switch to excel and deal with the modal box before the macro can continue.

Any ideas on how to not deal with the modal box.

my vb code looks like this:
    Dim oXL As Object
    Set oXL = GetObject("temp.xls", "EXCEL.SHEET")
    ' oXL.Application.SendKeys "{ENTER}"  
    ' sendkeys call from here have no effect
    oXL.Application.Run ("temp.xls!Macro1")

    Set oXL = Nothing

my xls ss has a matrix with three row heading columns (ie. the first three
columns of the first row are blank.   This is what causes excel concern
enough to give me the modal box prompting me to use the first row as
column headers.

my xls vba macro1 looks like this:
    oTotalRange.Application.SendKeys "{ENTER}"
    'SendKeys "{ENTER}"  also tried sendkeys statement, no effect
    oTotalRange.Subtotal GroupBy:=1, etc.



Sun, 16 Aug 1998 03:00:00 GMT  
 Suppressing EXCEL modal boxes through OLE
Rob-
I ran into this problem a year ago with a Save As Box and I got so
frustrated I ended up calling Microsoft. Try adding the following
line to your excel macro:
Application.DisplayAlerts=False
Remember to set back to =True once you pass the line that generates
the modal box. Let me know if it works.

Andrew W. Gray
The Ohio State University - ARMS Project

Quote:

> My vb4 app calls a vba macro in an excel spreadsheet to create sub-totals.
>  The excel function subtotal generates a modal box which I can't suppress
> from vb.  The Sendkeys statement and methods used either in the vb
> calling app or in the EXCEL macro won't suppress it.  I have to manually
> switch to excel and deal with the modal box before the macro can continue.

> Any ideas on how to not deal with the modal box.

> my vb code looks like this:
>     Dim oXL As Object
>     Set oXL = GetObject("temp.xls", "EXCEL.SHEET")
>     ' oXL.Application.SendKeys "{ENTER}"
>     ' sendkeys call from here have no effect
>     oXL.Application.Run ("temp.xls!Macro1")

>     Set oXL = Nothing

> my xls ss has a matrix with three row heading columns (ie. the first three
> columns of the first row are blank.   This is what causes excel concern
> enough to give me the modal box prompting me to use the first row as
> column headers.

> my xls vba macro1 looks like this:
>     oTotalRange.Application.SendKeys "{ENTER}"
>     'SendKeys "{ENTER}"  also tried sendkeys statement, no effect
>     oTotalRange.Subtotal GroupBy:=1, etc.



Fri, 21 Aug 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Excel Add-in displaying non-modal dialog box

2. OLE Access Excel (Datenimport von Excel in Access - muss nicht OLE sein)

3. Dialog Boxes - Application Modal vs. System Modal

4. HELP - Ole Automation - Excel (Text Boxes)

5. Ole Automation - Excel (Text Boxes)

6. Properties box as a modal box

7. Problem with draw order after calling modal a modal from from a modal form

8. modal , no modal and NO NO modal window

9. Excel OLE & Word OLE Viewing Question

10. Suppressing "Disable Macros" dialog box and suppressing other dialog boxes in word APPLICATION not document

11. Excel Macro - suppress user confirm action

12. Suppress Excel Userform In Word Mail Merge

 

 
Powered by phpBB® Forum Software