I've spent ages reading similar-ish posts, and made up some code to read the values from the title block on an idw.
Does it make any difference if the 'type' of the property feild is 'Prompted Entry' (I don't think it should)
I just want my VBA prog to read all the values in the titleblock. Here is the code to try and read one value, and then display it in a massage box:
Dim oPropsets As PropertySets
Set oPropsets = ThisApplication.ActiveDocument.PropertySets
Dim oBlock As PropertySet
Set oBlock = oPropsets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Dim oBlockProp As Property
For Each oBlockProp In oBlock
Select Case oBlockProp.Name
Case "COMPANY"
MsgBox oBlockProp.Value
End Select
Next
Thanks for any help
I have been experimenting with all the ways I think people
have been doing this, and I can't get anything to work.
I would like to know if this is actually possible, or
am I just wasting time.
If there is an old drawing, with 'prompted entry' info
in the title block, can I run a macro that will read that
titleblock information and display it in a textbox?
If so how?
I would be very grateful if someone could help me with this
Thanks
Joe
Thanks very much for the help, but as I'm a bit new to VBA
I am very frustrated with myself as I cannot understand
everything in the code.
I'm used to using subs, and am a bit unsure about functions.
I'm not sure what the 'ByRef oTbl As Inventor.titleblock'
is refering to in the arguments for the first function.
And is the 'ParseXML' important, as I can't find any
reference to it in my VBA help. How do the two functions
relate to each other, ie which on do I call.
And Im having trouble calling the functions, I'm not sure
what to put in the argument list.
(I'm worried I put the wrong thing in my original question,
I want to read the values from the titleblock, and just
use them elsewhere. As long as I can get a set of text
strings containing the values in the title block, i'll be
happy)
Thanks for the previous help
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"joeabberley" <
href="mailto:cad01@guttridge.co.uk">cad01@guttridge.co.uk> wrote in
message
href="news:f16292c.2@WebX.maYIadrTaRb">news:f16292c.2@WebX.maYIadrTaRb...
Thanks very much for the help, but as I'm a bit new to VBA
I am very frustrated with myself as I cannot understand
everything in the code.I'm used to using subs, and am a bit unsure about functions.
I'm not sure what the 'ByRef oTbl As Inventor.titleblock'
is refering to in the arguments for the first function.
And is the 'ParseXML' important, as I can't find any
reference to it in my VBA help. How do the two functions
relate to each other, ie which on do I call.
And Im having trouble calling the functions, I'm not sure
what to put in the argument list.(I'm worried I put the wrong thing in my original question,
I want to read the values from the titleblock, and just
use them elsewhere. As long as I can get a set of text
strings containing the values in the title block, i'll be
happy)Thanks for the previous help
Thanks for all the help. I have finally managed to get the titleblock info!
I used the suggest code from Lian Xie (thank you!) to get the values I wanted. I suppose it will be useful if I post my successful solution, just in case anyone else is interested:
Public Sub TitleBlock()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oTitle As Inventor.TitleBlock
Set oTitle = oDoc.ActiveSheet.TitleBlock
Dim oTextBox As TextBox
Dim oTextBoxes As TextBoxes
Dim sData As String
Set oTextBoxes = oTitle.Definition.Sketch.TextBoxes
For Each oTextBox In oTextBoxes
sData = oTitle.GetResultText(oTextBox)
If oTextBox.text = "COMPANY" Then
Company = sData
ElseIf oTextBox.text = "SALES ORDER No" Then
SalesOrderNo = sData
ElseIf oTextBox.text = "TITLE LINE 1" Then
TitleOne = sData
ElseIf oTextBox.text = "TITLE LINE 2" Then
TitleTwo = sData
ElseIf oTextBox.text = "DRAWING NUMBER" Then
DrgNoOne = sData
ElseIf oTextBox.text = "DRAWING NUMBER 2 " Then
DrgNoTwo = sData
ElseIf oTextBox.text = "DRAWN BY" Then
Author = sData
End If
Next
End Sub
Thats it!
(Note: if anyone who understands this is reading, I can't post this using the via newsgroup, using outlook newsreader. For some reason it wont accept my username and password for the discussion.autodesk.com server. This username and password work fine for the web based version...?)
Again, Thanks All
Joe