취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Excel and .NET Problems

해결 완료!
솔루션으로 이동

I know there is the RGT toolkit which I have and ActiveX which works, however, I would like to know if anyone has a solution to this problem using .NET. (@PhilipBrooks, .NET guru, if you are reading this.)

 

I am having problems determining the number of workbooks open with Excel and whether a particular file is open. Note the ActiveX versions posted here DO WORK, however I want to know why the .NET solutions do not work.

 

PNGs and VIs are attached.

 

Thanks for your help.

 

Regards,

mcduff

 

ActiveXCount.png

 

getReftoOpenEcel.png

 

 

 

 

모두 다운로드
0 포인트
1/16 메시지
6,697 조회수

Can you post the VIs for 2016 or earlier?

0 포인트
2/16 메시지
6,679 조회수

Thanks for looking into this.

 

mcduff

모두 다운로드
0 포인트
3/16 메시지
6,675 조회수

I've had no success yet, but based on this article I think you want the _Application property. The ApplicationClass is reserved for internal use. But when I select _Application it says no public constructors are available...

4/16 메시지
6,664 조회수

@Gregory wrote:

I've had no success yet, but based on this article I think you want the _Application property. The ApplicationClass is reserved for internal use. But when I select _Application it says no public constructors are available...


No, I think the ApplicationClass is correct.  However mcduff's code is creating a new instance of Excel, not grabbing the already opened instance.  If you put an ApplicationClass.Visible = True, you can see it flash onto the screen and then close. 

aputman
5/16 메시지
6,648 조회수

This still does not work, but you can convert to a more specific type to the _Application Class, even when I use this class I can not get the count or find item. I think aputman is on the right track, we need a reference to the excel application that is running.

 

mcduff

snip.png

 

 

 

0 포인트
6/16 메시지
6,633 조회수
솔루션
주제 작성자 mcduff이(가) 승인함

There is a way to do this in C# but I haven't figured out how to port this over to Labview .NET.

 

aputman
7/16 메시지
6,614 조회수

I think you are on the right track. Based on your previous comment, I too have been looking for the "GetObject" call in .net to try and get the current instance of excel. However, I cannot find it in any of the libraries that supposedly have it. I think if we can find that, then it may/should work.

Thanks again for looking.

 

Cheers,

mcduff

0 포인트
8/16 메시지
6,609 조회수
솔루션
주제 작성자 mcduff이(가) 승인함

Thanks for your hints I think a found a solution to get the current instance of excel. Thanks for your help.

 

See snippet and VI.

 

mcduff

snip2.png

 

 

 

9/16 메시지
6,599 조회수

Awesome.  I will have to take a look at this on Monday because I couldn't figure out how to get the Marshal object.  

aputman
0 포인트
10/16 메시지
6,591 조회수