PDA

View Full Version : Using VB to select text


Bodhran1
09-02-2004, 06:41 AM
I would like to create a script to go to an X,Y location on each sheet of my schematic and change the text there to a user defined letter.

Is there a way to select and modify TEXT using a VB script?

I can find ways to select PARTS, PINS, etc but not TEXT.

FYI: The text will always be at the same X,Y location and always have the same properties (size, justification etc).

I thought about using a macro, but is there a way to get input from the user and then apply that into the macro?


Thanks in advance!

Dave

H.Tikkanen
09-02-2004, 11:58 PM
One obvious solution would be using a component to carry the text. Create a non-eco, no-pin part and select only the attribute containing your text to be displayed.
Unfortunately, this part(s) would appear to BOM's, unless you modify the scripts to filter it out.

Victor Tejeda
09-10-2004, 03:30 PM
What I have done in past is to export the whole schematic as an ascii file, select all. open this file with notpad, or MSword. Search and replace your text, edit as necessary, save and import.
Remember to start with a new session with the correct sheet count and with out the sheet title blocks.
Or of course if you know the x,y locations. go to the sheet in question and use modless command "S" then x,y coordinates.

chuckt
09-27-2004, 10:57 AM
I have a simple script that does a text search/replace of "selected" or "all text" in the layout. I'm not sure if that will help you, let me know and I'll send it to you.

CT

Bodhran1
09-27-2004, 11:06 AM
Chuck,

Does this search for text in a schematic or in a layout?

I'd be interested in seeing your script either way. If it doesn't work on a schematic, it may give me some ideas to write my own.

Thanks in advance!

Dave

chuckt
09-27-2004, 11:09 AM
It works in layout. I dont't know what it will do in a schematic. Are you using PowerLogic?

Bodhran1
09-27-2004, 11:38 AM
Yes, we use PowerLogic and PowerPCB Ver 5.0.1

You can email me directly if you like at:

dpasquino@actechdrives.com

Judah
11-24-2011, 11:14 PM
The way to do this is to set the set the TakeFocusOnClick property of the CommandButton toFalse. Here are is the code I use.
Private Sub CommandButton1_Click()
Dim Sel As Selection
Set Sel = Application.Selection
If Sel.Type <> wdSelectionIP Then
MsgBox Sel.Text
End If
End Sub