Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default switching between workbooks not allowed in Excel

Hi,

I am using a VB Script to show a Bar Graph in our GUI through excel
workbook.

The call I am using in VB Script to create Excel Object is:
....
set ExcelObject = GetObject("", "Excel.Application")
....
Its working well when there is no Excel instance running previously.

If there is an existing excel sheet already open (opened manually and
unrelated to the GUI & VB Script), the GUI's Excel is taking control
of the Excel and I am unable to switch back to the Excel Sheet which
is opened manually. I can only switch to the previously running Excel
sheet only when I minimize the excel sheet in the GUI.

Could someone help me to overcome this or is this intended if so, any
justification for this ?

Steps which lead to a problem:
1. launch Excel manually from start - run - excel.exe
2. launch Excel in the my own GUI with the VBScript which is using
GetObject() call

At this point, I am not able to switch to the Excel instance which is
opened in step 1.

Thanks in advance,
Ravi Nandibhatla.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default switching between workbooks not allowed in Excel

Hi
don't know about VB Script but in VBA you might use

On Error Resume Next
Err.Clear
Set ExcelObject1 = GetObject(, "Excel.Application") 'If
Excel is already open, flag it with Boolean
If Err.Number < 0 Then ExcelWasRunning = False Else
ExcelWasRunning = True
On Error GoTo 0
Err.Clear 'keep err tidy
If Not ExcelWasRunning Then
set ExcelObject2 = GetObject("", "Excel.Application")
End If

Now you can refer to the two instances of Excel, if there are two.
regards
Paul

On Mar 23, 8:38 am, "nandibhatla" wrote:
Hi,

I am using a VB Script to show a Bar Graph in our GUI through excel
workbook.

The call I am using in VB Script to create Excel Object is:
...
set ExcelObject = GetObject("", "Excel.Application")
...
Its working well when there is no Excel instance running previously.

If there is an existing excel sheet already open (opened manually and
unrelated to the GUI & VB Script), the GUI's Excel is taking control
of the Excel and I am unable to switch back to the Excel Sheet which
is opened manually. I can only switch to the previously running Excel
sheet only when I minimize the excel sheet in the GUI.

Could someone help me to overcome this or is this intended if so, any
justification for this ?

Steps which lead to a problem:
1. launch Excel manually from start - run - excel.exe
2. launch Excel in the my own GUI with the VBScript which is using
GetObject() call

At this point, I am not able to switch to the Excel instance which is
opened in step 1.

Thanks in advance,
Ravi Nandibhatla.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default switching between workbooks not allowed in Excel

Hi Paul,

Thank you for the reply.

I am having the problem with one excel instance opened manually from
Windows start - run prompt and other excel opened from the GUI using
a VB Script. I do not want to refer to the previously opened excel
instance in my VB Script.
steps to reproduce a
a. open excel.exe from windows - start - run prompt
b. launch my GUI which in turn shows an Excel chart using VB Script
c. Now at this point, I am unable to switch back to the excel.exe
opened in step a.

Is this good enough to understand my problem ?

Thanks,
Ravi Nandibhatla.

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
Switching between Workbooks Doekoe Excel Discussion (Misc queries) 0 May 5th 08 10:54 AM
Switching between workbooks Jim Excel Discussion (Misc queries) 5 July 28th 07 03:19 AM
Switching Between 2 workbooks using VBA Isit Ears[_2_] Excel Programming 1 October 17th 06 01:33 PM
switching between workbooks... safdarhassan Excel Programming 3 August 12th 06 01:06 PM
Switching Workbooks in vbscript Joe[_3_] Excel Programming 1 August 25th 04 09:09 PM


All times are GMT +1. The time now is 12:52 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"