LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I autosize columns in Excel using ActiveX in Labview

I found the ExcelExamples.llb but nothing that describes this. My data is sometimes bigger than the default column width.

thanks.
0 Kudos
Message 1 of 9
(6,291 Views)
The first resource to check for methods and properties (related to MS Office environment) is the integrated Visual Basic help.

Anyway, in this particular case, you need to "obtain" a column/row collection related to the worksheet you are using (for example, either by .Columns("A:I") or .Range("A1:E1").Columns) and call ".AutoFit" method.

Hope this helps
Message 2 of 9
(6,291 Views)
Can I get a little more info? Maybe a small vi as an example? I still don't get it.
0 Kudos
Message 3 of 9
(6,291 Views)
Find attached Write Table To XL.vi. I included a "columns" property and a "autofit" method (for our range - in this case, all columns). If you want a custom range, use "Range" method instead of "columns" property.

Hope this helps ... better
Message 4 of 9
(6,291 Views)
Thanks!!!
0 Kudos
Message 5 of 9
(6,291 Views)

After playing with activx I found the way for all options to work

Not working without sequence

 

alexela_0-1660566886376.png

 

With sequence all working well, any other activx

 

alexela_1-1660566986439.png

 

 

 

Download All
0 Kudos
Message 6 of 9
(3,015 Views)

The reason your code doesn't work "without sequence" is you are not using the Error Line.  You would greatly improve your LabVIEW code (and help others to understand it) if you always make your wires go left-to-right (and never bring an "output" wire back underneath a function and make it "appear" to come out of the left side as you do in Excel Get ActiveX).  You want to do the Excel Save Report after you close the Columns reference -- wiring Error Out from Columns Reference to Error In of Save Report (and wiring the Error line through the preceding functions, as well) would fix this!

 

Bob Schor

0 Kudos
Message 7 of 9
(3,002 Views)

Nothing to add. You right. 

But still, activex is working with autofit.

 

Thanks for the point. 

0 Kudos
Message 8 of 9
(2,999 Views)

Alexela,

 

     As a "beginner" with LabVIEW, I used Sequence structures until my mentor taught me that Error Lines do a lot more than help report Errors.  In the next phase of my "LabVIEW Life", I had a very negative opinion of the Sequence structure, and almost never used it (except when using some of the Time functions).

 

     Until a few years ago when I was introduced to the "magic" of FPGA programming, where the Sequence structure took on a necessary "sequencing" function.  So it's all knowing "when and where" the Sequence is appropriate ...

 

Bob Schor

0 Kudos
Message 9 of 9
(2,985 Views)