LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

goto bookmark.vi what=-1?

what is -1 means and whatelse can the value be?
In the example "Create Widget Test Report.vi".The example demos how to open word -update the bookmark-. In a sub-vi goto bookmark.vi what is assigned -1. Can you explain -1 and whatelse can we use.
I also would like to modify the vi to open word with the filename for the user to review the document and he/she can choose whether to print or execute any Word command, and then finally exit/close Word.
0 Kudos
Message 1 of 7
(3,553 Views)
It took me a hwile to figure out that the example you're refering to is this one. To get information on the methods of properties of MS Word, the first place to start looking is in Word's Visual Basic editor. You should be able to use the object browser and VB help files to get the information you need.
0 Kudos
Message 2 of 7
(3,553 Views)
From the Microsoft Word Help:
"What Optional Variant. The kind of item that the range or selection is to be moved to. Can be one of the following WdGoToItem constants:

wdGoToBookmark wdGoToComment wdGoToEndnote wdGoToEquation wdGoToField wdGoToFootnote wdGoToGrammaticalError wdGoToGraphic wdGoToHeading
wdGoToLine wdGoToObject wdGoToPage wdGoToPercent wdGoToProofreadingError wdGoToSection wdGoToSpellingError wdGoToTable"

-1 means it can be any of the above.
You can either wire a numeric to this input in LabVIEW, each number represent the index of the element in the above list, or input a string with the name of the element.

Zvezdana S.
National Instruments
Message 3 of 7
(3,553 Views)
Thank you for helping me. Your answer is very good and to the point. I need to document the VI that I am working on.
Would you please tell me how to reference the constant?
In the same Word.llb, -> create widget..there is a Borders set line width.VI and the input is -2; -3; -4
And there is a VI Create Report Title.VI with a Invoke node with Selection - Style = -63.
I would like to have more info for the guy that maintain this project five years from now.
0 Kudos
Message 4 of 7
(3,553 Views)
All of these properties and methods are explained in the Word Help. You can access it when you right click on the property or invoke node in LabVIEW.
"Index Required Variant. The name or index number of a member of the collection. The index can be a numeric expression (a number from 1 to the value of the collection's Count property), a constant, or a string. For more information about using the Item method with a specific collection, see the Help topic for that collection."
In the Borders Set LineWidth VI is where the Borders>>Item Index invoke node is being set. Since you are documenting the VI for others to use it, I would suggest you modify this VI:
Usually, when you wire -1 to a "counting" node, such as index, it would mean all. However,
some methods are different. I would suggest you delete the numeric input to this node, right click on the node, and create a control. It will not create a numeric, but the actual name of that element. It will be displayed in a Text Ring. This would be easier for everyone to understand. You can also right click on this control and choose to show Digital Display. This will tell you which index corresponds to which name. For some reason, who ever designed this methods in Microsoft, decided to have negative indexes.
Similar for Style property. Much better approach is to use the text ring instead of the numeric input.

Zvezdana S.
0 Kudos
Message 5 of 7
(3,553 Views)
Hi Zvezdana,
I tried with Borders Set LineWidth.Vi and succeeded, I got a text ring and the digital display is really helpful.
I then tried with Style property, I deleted the wire to the constant -63 and right-click the Style -create a control- I got a strange control (no text ring). I am not sure how to describe the control, but on the front panel, I right-click the control and saw (show data is checkmarked) when I click on "show type", the control has the word "void". On the diagram, the control looks like a round corner rectangle with two ends smaller). The only disappointment is no text ring and digital display to describe the constant -63.
Message 6 of 7
(3,553 Views)
Sorry, I didn't test the Style node. This node expects a Variant data type. That is the strange looking control that you are seeing. A Variant can be any type, you just need to type cast it into variant.
What you could do is create a Text Ring, which would have all the Style options described in the Word Help for this node. I think there are around 100 of them.
Then, you would use To Variant function, located under Advanced>>Data Manipulation palette, and wire the variant output to the Style node.
This takes a little more programming on your side, but the future user will better understand what is happening.

Zvezdana S.
0 Kudos
Message 7 of 7
(3,553 Views)