Parameters in CATIA VBA - vba

In CATIA, every feature have its own properties corresponding to specific addresses representing it. For example, pad.1 feature has FirstLimit as a property with Length as a parameter of it (as see in the picture). Is it possible to work with this available and default parameters or properties or features through VBA, to, for instance, change the value of some of those parameters, as the way I work with Formulas dialogue as shown in the attached picture.

Related

Determining Type of Dynamically Created Controls

I have a Userform that populates a series of Check boxes, Text boxes, and Combo boxes based on the content of a dictionary. The initialization of the Userform dynamically creates all the Control Objects and names them according to the type of control that they are and an index I have provided that corresponds to the dictionary object they were generated from. After the user interacts with the Userform, they click a button to process the results and the information in the controls are written to a class object for use in the next step of the program.
I need to be able to loop through the different controls objects, determine type of control that it is (ProgID), and check data/value within the object. I am having trouble finding an identifier that will allow me to differentiate between the various types of controls.
Currently, I am looping through the UserForm.Controls.Item list to have the objects returned to me. I cannot find any method of identifying the type of control from this object to determine what information needs to be pulled from it. Each type of control is written to a different property of the Class object.
Too Long; Didn't Read:
I need a way to determine the ProgID (or equivalent identifier) of an object returned from the Userform.Controls.Item function.

How Can I Comprehensively Manage my VBA UserForm's Properties?

I am writing my first VBA Add-In under Microsoft Office Word 2007 with Windows 7 Pro/64. Part of this Add-In is a UserForm. Using the Visual Basic editor that runs from Word, I find there are two ways of viewing, and two ways of modifying a UserForm's properties:
View all properties from Object Browser (F2)
View some properties and edit them from Properties Window (F4)
Manually enter and edit any property from the Code window (F7)
Here is a screenshot of my Properties and Code windows:
A problem I find is that the Properties Window contains only a subset of the UserForm's properties (notice that CanPaste, CanRedo, and CanUndo don't appear in Properties), and changes made in the Properties Window are overridden by changes made in the Code window (e.g., at runtime, Me.Caption from the Code window above overrides the Caption field in Properties).
I suppose I should avoid using Properties at all then, and enter all settings via UserForm_Initialize as shown above. But (a) for some settings, Properties makes several settings at once. For example, selecting Verdana Bold from Properties equals Font = Verdana and Font.Bold = True in Code. And (b) it seems Properties sets the subset of properties it controls to defaults of its choosing, and if I change them I can't see what they started out as.
I therefore desire unified and comprehensive access to all my UserForm's properties at once, including the aforementioned default settings. Does anyone know how to reveal a UserForm's default settings as code, or to automatically open all its current settings in the Code window? Is there an umbrella mechanism I'm not aware of?
I'm not a veteran VBA programmer, but I can't believe my experience is unique. I've searched the 'net in vain for a solution. How do you with more experience manage this dilemma?
You use the Properties window to set appearance-related properties at design time. Those property values will then always apply unless you explicitly change them at run-time with VBA code.
Properties that don't relate to appearance, such as CanPaste and CanRedo relate to the state of the form at run-time, so it doesn't make sense to have them configurable at design-time.
You can change nearly all of the properties at run-time, whether it is in the Initialize event or elsewhere. You can even add controls at run-time, but your changes won't be persisted once the instance of the form terminates.

Programmatic access to Visio shape tooltip

To avoid an XY problem, here's what I'm trying to accomplish: when a shape is selected, I want detail text about that shape to appear on the screen.
I first tried using Shape Data, but it supports only single-line name=value pairs. My detail information is an arbitrary, multiline text blob.
My next thought was to used the shape's ScreenTip (aka tooltip) to hold the text data, then write some VBA code to handle the _SelectionChanged event. When a shape is selected I want to copy it's ScreenTip text into the text of another object (my details panel).
I got the _SelectionChange event-handling working, but poking around the Selection object in the debugger I can't find any property of the selected object that exposes the ScreenTip information.
Is Visio's programming API too anemic to support his kind of thing? Is there another way I might be able to do this? Is there another tool that might be better for this (preferably free)?
Visio's API is capable of doing this, handily.
It seems you're not aware of Visio's shapesheet, which is where the screen tip text is stored, along with pretty much anything you'd want to know about a shape.
To access the screen tip text you simply read the Comment cell from the selected shape's shapesheet:
Application.Selection(1).CellsU("Comment").ResultStr(visNone)
This code will return the comment text.
You're on the right track using the SelectionChange event, though of course you're checking that the selection count = 1, or at least >0.

Shape click opens external data tab

I am trying to get my visio to be able to open a certain external data tab when a certain shape is clicked. I have found how to link the data from a specific row to a shape but not the other way around. Is this even possible?
It looks like this will help you VISIO - highlight specific row in the data file when clicking on the corresponding shape in Visio.
Some of the highlights include: The way to gain access to that window is to loop through each of the ActiveWindow.Windows. When you come across one that has the ID of visWinIDExternalData then you can control the Window.SelectedDataRecordset and Window.SelectedDataRowID properties. The code left by the Microsoft MVP in that forum also includes how to get the DataRecordsetID and DataRowID from the selected shape thus enough data is available to provide the window with the selection that you desire.
Additional resources:
Shape.GetLinkedDataRow Method (Visio)
Shape.GetLinkedDataRecordsetIDs Method (Visio)
Window.SelectedDataRecordset Property (Visio)
Window.SelectedDataRowID Property (Visio)

Accessing standard VBA word enumerations

I'm new to VBA. Some tutorials tell me to use enumeration constants such as wdOrientLandscape and wdRowHeightExactly (to change page orientation and make row height 'exact' respectively). However, when debugging, I can see that the value of these constants is Empty and they don't 'work' as expected.
Do I need to do something special to access these constants e.g. add a reference or something?
I'm creating a Word document from an Excel macro.
Thanks in advance
Within Excel (or any automation client) the enumerations belonging to the Word object model are not exposed if you use Late Binding (CreateObject("Word.Application")).
If you early bind by adding a reference they become visible.
If you add Option Explicit to the top of you code modules (or select Require Variable Declarations from the VBA editor options) you will receive a compile time warning if you attempt to use something that's not declared/unavailable
In your particular case, you would want to add the Microsoft Word Object Library to your references. If you choose to early bind. This can be done by going to Tools>>References and checking the appropriate box.