Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default two same workbooks opened -- don't want this

Dear all,

I have the excel file which is opened and run the dllfunction which will
manipulate this excel file.
How can I write in dllfunction so that it can work the excel file which has
been opened??

Let me mention more clearly.
xlapp=new excel.applicationclass() // Actually test.xls has been opened.
xlworkbook=xlapp.WorkBooks.open("test.xls",....); // open again, it will
make two test.xls excel screen. How to eliminate this and working on the
existing opened excel file??
.............................
I want as below.

if (There is instance of excel exists)
{
set xlApp to be excel instance
set xlWorkBook=xlApp.ActiveWorkBook;
}
else
{
create new excel instance and set to xlApp.
set xlWorkBook=xlApp.Workbooks.Open(...........)
}


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default two same workbooks opened -- don't want this

I Usually use CreateObject and Getobject together and don't use Open.

Test if object exists. If it doesn't then use getobject to open the workbook.

"rchiuhk" wrote:

Dear all,

I have the excel file which is opened and run the dllfunction which will
manipulate this excel file.
How can I write in dllfunction so that it can work the excel file which has
been opened??

Let me mention more clearly.
xlapp=new excel.applicationclass() // Actually test.xls has been opened.
xlworkbook=xlapp.WorkBooks.open("test.xls",....); // open again, it will
make two test.xls excel screen. How to eliminate this and working on the
existing opened excel file??
.............................
I want as below.

if (There is instance of excel exists)
{
set xlApp to be excel instance
set xlWorkBook=xlApp.ActiveWorkBook;
}
else
{
create new excel instance and set to xlApp.
set xlWorkBook=xlApp.Workbooks.Open(...........)
}



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
History of Workbooks opened derek Excel Worksheet Functions 1 May 20th 09 05:55 PM
Transfer data between 2 workbooks opened with IE wacNTN Excel Programming 0 December 8th 08 09:46 PM
always prompted to save opened workbooks kjbrr Excel Discussion (Misc queries) 2 July 31st 06 08:10 PM
Reference to Multiple Opened Workbooks [email protected] Excel Programming 3 March 14th 06 01:03 PM
Format by VB opened Workbooks/sheets exceller Excel Programming 1 June 14th 04 06:33 PM


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