LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Excel window title

Hi,

 

I am trying to get the handle of an Excel file using the attched code. This works fine when I have only opened excel application without any workbooks opened so the window title is "Microsoft Excel". When I open a file, the title changes to eg. "Book1 - Mocrosoft Excel" or "Book1.xlsx - Microsoft Excel" (depending on whether I have saved Book1 or not) and the code doesn't work if I input these names.

 

What I am doing wrong in here?

 

SL

 

Download All
0 Kudos
Message 1 of 5
(3,024 Views)

@solanki2 wrote:

Hi,

 

I am trying to get the handle of an Excel file using the attched code. This works fine when I have only opened excel application without any workbooks opened so the window title is "Microsoft Excel". When I open a file, the title changes to eg. "Book1 - Mocrosoft Excel" or "Book1.xlsx - Microsoft Excel" (depending on whether I have saved Book1 or not) and the code doesn't work if I input these names.

 

What I am doing wrong in here?

 

SL

 


Why don't you use ActiveX? This following code gives you the name of the active workbook.

 

Get workbook name.png

 

Ben64

0 Kudos
Message 2 of 5
(2,980 Views)

@ben64 wrote:

Why don't you use ActiveX? This following code gives you the name of the active workbook.

 

Get workbook name.png

 

Ben64


Ben,  I little micronugget for you.

!0.png

Smiley Surprised

WHAT! How did I do that with one P-Node.!

 

When you create the property node and right click to select a property- choose Browse... (right at the top) any properties that return references can be expanded until you get the property you are really interested in.  Expert TIP: choose Name Format.Long Names when you do this to make the code more readable.  The BD cost is minimal compared to having multiple P-nodes with short names.


"Should be" isn't "Is" -Jay
Message 3 of 5
(2,971 Views)

Great Tip!

 

Thanks Jeff.

 

Ben

0 Kudos
Message 4 of 5
(2,968 Views)

Thak you very much guys. I was using AcitveX but, the problem was in the Call Library Function Node. It was not generating the handle properly due to wrong data type I've used. Changed it to Unsigned Pointer-sized Integer from U32 and it is happy now.

Thanks again for the useful tips though.

0 Kudos
Message 5 of 5
(2,931 Views)