Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to hide Excel window when activating a Shape object

Since my second posting has been posted for two weeks
without getting an anwser, I hope this re-posting could
get help from somebody. Thanks in advance.

The following is my second posting:

Yes, I tried this but it does not help. My codes look like:

excel_app = CreateObject("Excel.Application")
' or excel_app = new Excel.Application
excel_app.Visible = False ' Actually it defaults to False
workbook = excel_app.Workbooks.Open("myfile.xls")
worksheet = workbook.Worksheets("Sheet1")
shape = worksheet.Shapes.Item(1)
......

It seems that the Excel automation server, when invoked
with "Verb" function call, will always try to set the
Excel app's visibility to True. I am not sure if we have
other ways to tell the server at the invoke time that we
do not want to display the window.

Thanks,
Yi

-----Original Message-----
Have you tried:

Application.Visible = False
....
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen )
....
Application.Visible = True

--
Bob Kilmer


"Yi" wrote in message
...
I have a VB application that processes an Excel file.

The
Excel file has a Chart (actually a Workbook) Shape

object
embedded in it. The application needs to activate the
Shape object in order to update the data in the

worksheet.
When the following code is called, the Excel window will
always popup.
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen)

Can anybody tell me how to hide the Excel window when

this
code is called? I can only find two types of verbs -

Open
and Primary, and they both display the window.

Or, is there any other way to activate the OLE object
without displaying the Excel window?

Thanks in advance.
Yi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to hide Excel window when activating a Shape object

Have you tried using ScreenUpdating, such as
application.ScreenUpdating = false

-----Original Message-----
Since my second posting has been posted for two weeks
without getting an anwser, I hope this re-posting could
get help from somebody. Thanks in advance.

The following is my second posting:

Yes, I tried this but it does not help. My codes look

like:

excel_app = CreateObject("Excel.Application")
' or excel_app = new Excel.Application
excel_app.Visible = False ' Actually it defaults to False
workbook = excel_app.Workbooks.Open("myfile.xls")
worksheet = workbook.Worksheets("Sheet1")
shape = worksheet.Shapes.Item(1)
......

It seems that the Excel automation server, when invoked
with "Verb" function call, will always try to set the
Excel app's visibility to True. I am not sure if we have
other ways to tell the server at the invoke time that we
do not want to display the window.

Thanks,
Yi

-----Original Message-----
Have you tried:

Application.Visible = False
....
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpe n)
....
Application.Visible = True

--
Bob Kilmer


"Yi" wrote in message
.. .
I have a VB application that processes an Excel file.

The
Excel file has a Chart (actually a Workbook) Shape

object
embedded in it. The application needs to activate the
Shape object in order to update the data in the

worksheet.
When the following code is called, the Excel window

will
always popup.
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen)

Can anybody tell me how to hide the Excel window when

this
code is called? I can only find two types of verbs -

Open
and Primary, and they both display the window.

Or, is there any other way to activate the OLE object
without displaying the Excel window?

Thanks in advance.
Yi


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to hide Excel window when activating a Shape object

I tried this and found that it does not help.
ScreenUpdating() may block updating screen display but
does not turn off the window.

I know that in Word automation there is a way to do this.
The code is as: shape_in_word.OLEFormat.DoVerb
(word.WdOLEVerb.wdOLEVerbHide)

Thanks,
Yi

-----Original Message-----
Have you tried using ScreenUpdating, such as
application.ScreenUpdating = false

-----Original Message-----
Since my second posting has been posted for two weeks
without getting an anwser, I hope this re-posting could
get help from somebody. Thanks in advance.

The following is my second posting:

Yes, I tried this but it does not help. My codes look

like:

excel_app = CreateObject("Excel.Application")
' or excel_app = new Excel.Application
excel_app.Visible = False ' Actually it defaults to

False
workbook = excel_app.Workbooks.Open("myfile.xls")
worksheet = workbook.Worksheets("Sheet1")
shape = worksheet.Shapes.Item(1)
......

It seems that the Excel automation server, when invoked
with "Verb" function call, will always try to set the
Excel app's visibility to True. I am not sure if we have
other ways to tell the server at the invoke time that we
do not want to display the window.

Thanks,
Yi

-----Original Message-----
Have you tried:

Application.Visible = False
....
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen )
....
Application.Visible = True

--
Bob Kilmer


"Yi" wrote in message
. ..
I have a VB application that processes an Excel file.

The
Excel file has a Chart (actually a Workbook) Shape

object
embedded in it. The application needs to activate the
Shape object in order to update the data in the

worksheet.
When the following code is called, the Excel window

will
always popup.
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen)

Can anybody tell me how to hide the Excel window when

this
code is called? I can only find two types of verbs -

Open
and Primary, and they both display the window.

Or, is there any other way to activate the OLE object
without displaying the Excel window?

Thanks in advance.
Yi


.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default How to hide Excel window when activating a Shape object

Hi Yi,

I don't believe it's possible to prevent Excel from making itself visible
in this situation.

The workaround is to re-hide the Excel instance.

The side effect of the workaround above is that Excel will briefly appear
on the screen, then immediately disappear by setting the Visible to False.
If you would like to prevent this "flash" of Excel, you can move the Excel
window off the screen before calling the xlVerbOpen, and then later restore
the previous position before quitting the instance.

Here is a modified version of your code that shows how:

Private Sub Command1_Click()
Dim exApp As Excel.Application
Set exApp = New Application
Dim WS As Worksheet
Dim Wk As Workbook
Dim exLeft As Double
exApp.Visible = False ' Actually it defaults to False
Set Wk = exApp.Workbooks.Open("c:\myfile.xls")
Set WS = Wk.Worksheets("Sheet1")
exApp.ScreenUpdating = False
exLeft = exApp.Left
exApp.Left = -10000
WS.Shapes(1).OLEFormat.Verb (Excel.XlOLEVerb.xlVerbOpen)
exApp.Visible = False
exApp.Left = exLeft
Wk.Close SaveChanges:=False
exApp.Quit
Set exApp = Nothing
End Sub

Hope this helps.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Yi"
Sender: "Yi"
References:


Subject: How to hide Excel window when activating a Shape object
Date: Tue, 7 Oct 2003 05:41:32 -0700
Lines: 86
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOM0FX6VtGVkq6uSQGxU6wFAwMlmg==
Newsgroups: microsoft.public.excel.programming
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.excel.programming:421862
NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
X-Tomcat-NG: microsoft.public.excel.programming

I tried this and found that it does not help.
ScreenUpdating() may block updating screen display but
does not turn off the window.

I know that in Word automation there is a way to do this.
The code is as: shape_in_word.OLEFormat.DoVerb
(word.WdOLEVerb.wdOLEVerbHide)

Thanks,
Yi

-----Original Message-----
Have you tried using ScreenUpdating, such as
application.ScreenUpdating = false

-----Original Message-----
Since my second posting has been posted for two weeks
without getting an anwser, I hope this re-posting could
get help from somebody. Thanks in advance.

The following is my second posting:

Yes, I tried this but it does not help. My codes look

like:

excel_app = CreateObject("Excel.Application")
' or excel_app = new Excel.Application
excel_app.Visible = False ' Actually it defaults to

False
workbook = excel_app.Workbooks.Open("myfile.xls")
worksheet = workbook.Worksheets("Sheet1")
shape = worksheet.Shapes.Item(1)
......

It seems that the Excel automation server, when invoked
with "Verb" function call, will always try to set the
Excel app's visibility to True. I am not sure if we have
other ways to tell the server at the invoke time that we
do not want to display the window.

Thanks,
Yi

-----Original Message-----
Have you tried:

Application.Visible = False
....
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpe n)
....
Application.Visible = True

--
Bob Kilmer


"Yi" wrote in message
.. .
I have a VB application that processes an Excel file.
The
Excel file has a Chart (actually a Workbook) Shape
object
embedded in it. The application needs to activate the
Shape object in order to update the data in the
worksheet.
When the following code is called, the Excel window

will
always popup.
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen)

Can anybody tell me how to hide the Excel window when
this
code is called? I can only find two types of verbs -
Open
and Primary, and they both display the window.

Or, is there any other way to activate the OLE object
without displaying the Excel window?

Thanks in advance.
Yi

.

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to hide Excel window when activating a Shape object

Thanks, Peter.

Your solution is very good. It almost perfect except the
flash of the Excel application icon at the bottom of the
window - if I have five Chart objects in one file, it
would flash five times during processing of this file.

I have found another way to resolve this problem - 1. for
each shape object, call its Copy() method; 2. open a Word
document object; 3. call Paste to the Word application; 4.
find the shape object in the document and
call "OLEFormat.DoVerb(Word.WdOLEVerb.wdOLEVerbHide )" to
this object; 5. process the object (it is an Excel
Workbook); 6. Copy and Paste back to the shape object in
Excel file.

This solution is good in that there is no Excel window
flashing at all. But it is slower.

Thanks again for your excellent solution.

Best regards,
Yi

-----Original Message-----
Hi Yi,

I don't believe it's possible to prevent Excel from

making itself visible
in this situation.

The workaround is to re-hide the Excel instance.

The side effect of the workaround above is that Excel

will briefly appear
on the screen, then immediately disappear by setting the

Visible to False.
If you would like to prevent this "flash" of Excel, you

can move the Excel
window off the screen before calling the xlVerbOpen, and

then later restore
the previous position before quitting the instance.

Here is a modified version of your code that shows how:

Private Sub Command1_Click()
Dim exApp As Excel.Application
Set exApp = New Application
Dim WS As Worksheet
Dim Wk As Workbook
Dim exLeft As Double
exApp.Visible = False ' Actually it defaults to False
Set Wk = exApp.Workbooks.Open("c:\myfile.xls")
Set WS = Wk.Worksheets("Sheet1")
exApp.ScreenUpdating = False
exLeft = exApp.Left
exApp.Left = -10000
WS.Shapes(1).OLEFormat.Verb (Excel.XlOLEVerb.xlVerbOpen)
exApp.Visible = False
exApp.Left = exLeft
Wk.Close SaveChanges:=False
exApp.Quit
Set exApp = Nothing
End Sub

Hope this helps.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and

confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Yi"
Sender: "Yi"
References:


Subject: How to hide Excel window when activating a

Shape object
Date: Tue, 7 Oct 2003 05:41:32 -0700
Lines: 86
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOM0FX6VtGVkq6uSQGxU6wFAwMlmg==
Newsgroups: microsoft.public.excel.programming
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl

microsoft.public.excel.programming:421862
NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
X-Tomcat-NG: microsoft.public.excel.programming

I tried this and found that it does not help.
ScreenUpdating() may block updating screen display but
does not turn off the window.

I know that in Word automation there is a way to do

this.
The code is as: shape_in_word.OLEFormat.DoVerb
(word.WdOLEVerb.wdOLEVerbHide)

Thanks,
Yi

-----Original Message-----
Have you tried using ScreenUpdating, such as
application.ScreenUpdating = false

-----Original Message-----
Since my second posting has been posted for two weeks
without getting an anwser, I hope this re-posting

could
get help from somebody. Thanks in advance.

The following is my second posting:

Yes, I tried this but it does not help. My codes look
like:

excel_app = CreateObject("Excel.Application")
' or excel_app = new Excel.Application
excel_app.Visible = False ' Actually it defaults to

False
workbook = excel_app.Workbooks.Open("myfile.xls")
worksheet = workbook.Worksheets("Sheet1")
shape = worksheet.Shapes.Item(1)
......

It seems that the Excel automation server, when

invoked
with "Verb" function call, will always try to set the
Excel app's visibility to True. I am not sure if we

have
other ways to tell the server at the invoke time that

we
do not want to display the window.

Thanks,
Yi

-----Original Message-----
Have you tried:

Application.Visible = False
....
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOp en)
....
Application.Visible = True

--
Bob Kilmer


"Yi" wrote in message
. ..
I have a VB application that processes an Excel

file.
The
Excel file has a Chart (actually a Workbook) Shape
object
embedded in it. The application needs to activate

the
Shape object in order to update the data in the
worksheet.
When the following code is called, the Excel window
will
always popup.
shape.OLEFormat.Verb(Excel.XlOLEVerb.xlVerbOpen)

Can anybody tell me how to hide the Excel window

when
this
code is called? I can only find two types of verbs -


Open
and Primary, and they both display the window.

Or, is there any other way to activate the OLE

object
without displaying the Excel window?

Thanks in advance.
Yi

.

.



.

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
Activating object from Excel cell Amnon Wilensky Excel Worksheet Functions 2 March 29th 09 06:46 PM
Close Excel server after activating OLE object Goofball Excel Discussion (Misc queries) 1 March 13th 08 05:32 PM
Activating a Chart object Hari Prasadh Charts and Charting in Excel 6 August 2nd 05 07:22 PM
How to hide Excel window when activating a Shape object Bob Kilmer Excel Programming 0 September 27th 03 03:51 PM
Hide/Show modeless userform when activating/deactivating workbooks Jeremy Gollehon[_2_] Excel Programming 0 August 28th 03 11:05 PM


All times are GMT +1. The time now is 05:56 AM.

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"