From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Formatting

Solved!
Go to solution

I am trying to change the text style in Excel using ActiveX.  I've been able to do things like set the horizontal and vertical alignment and set the row height and column width.  Right clicking on the property node and selecting Help For Style has not been very helpful. (Neither has the other Help For ... with Excel ActiveX property nodes.  I found the others on this message board.)

 

I would like to see some documentation on these properties and what type of data they expect.  I've even been to the excel board on breakpoint and it has alot of useful information but not what I'm looking for.  If anyone can help, I would greatly appreciate it.

Ron Deavers, CLD
0 Kudos
Message 1 of 6
(3,582 Views)

I am assuming you've installed the Visual Basic Help for Excel, otherwise the right-clicking won't display the help for that particular property/method. Other than that, the definitve help is on MSDN.

 

Usually the best way to figure out what you need to do is to record a macro in Excel doing what you want to do. Then, switch to the VBA editor and you can see the exact commands.  

Message 2 of 6
(3,575 Views)
Solution
Accepted by topic author programmindragon

For example, if I start the macro recorder and click on a cell and select "Format -> Cells..." and set it up for Bold, 8 pt, the VBA code looks like this:

 

     With Selection.Font
        .Name = "Arial"
        .FontStyle = "Bold"
        .Size = 8
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With

 

This can be written in LabVIEW this way:

 

Message Edited by smercurio_fc on 09-05-2008 12:13 PM
Message 3 of 6
(3,571 Views)
Now that is cool.  -SS


0 Kudos
Message 4 of 6
(3,564 Views)
Thank you very much.  I was trying to use the Style property of the Range property node to do my text formatting.  I appreciate your help.
Ron Deavers, CLD
0 Kudos
Message 5 of 6
(3,523 Views)
You can do it either way. I just happened to use the "Format -> Cells" just for example. Note that in the LabVIEW code you don't actually have to set a value for every property like it's done in the VBA code. You can just set the properties you need to set. In my example I really only needed to set the size and the bold attribute. The rest were shown for information.
0 Kudos
Message 6 of 6
(3,505 Views)