I want to create a text in all sheet with same position via vba

I want to create a text in all sheet with same position via vba

k14348
Advocate Advocate
549 Views
4 Replies
Message 1 of 5

I want to create a text in all sheet with same position via vba

k14348
Advocate
Advocate

Hi,

  I have 10 no. of idw drawing sheets. In all the 10 sheets i want to create a text(General Notes) with same position. Can anybody help on this?

 

If this is not possible, I wil write that text in the first sheet in one position. that program should find the text and position then copy that to all sheets.

 

-karthikeyanM

 

0 Likes
550 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Instead of using VBA, you could just change the title block to include the text.

0 Likes
Message 3 of 5

pball
Mentor
Mentor

Here is some code to add a textbox to a drawing at a given location. I believe the location is in cm but I only used trial and error to position my text so I'm not sure.

 

If you need help with making this work on all sheets just say something, I'm busy at the moment so hopefully this will start you off.

 

    Dim invDoc As Document
    Set invDoc = ThisApplication.ActiveDocument

    Dim stext As String
    stext = "<StyleOverride FontSize = '0.1524'>" & "EXPORTED " & ": " & Now() & "     BY: " & ThisApplication.GeneralOptions.UserName & "</StyleOverride>"

    Dim oGeneralNotes As GeneralNotes
    Set oGeneralNotes = invDoc.ActiveSheet.DrawingNotes.GeneralNotes

    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

'Set text location and create textbox Dim oGeneralNote As GeneralNote Set oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(1, 0.25), stext)
Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes
Message 4 of 5

k14348
Advocate
Advocate
This method is difficult when i want to edit notes.
0 Likes
Message 5 of 5

k14348
Advocate
Advocate
Public Sub PlaceText()
    Dim invDoc As Document
    Set invDoc = ThisApplication.ActiveDocument

    Dim stext As String
    stext = "GENERAL NOTES"

    Dim oGeneralNotes As GeneralNotes
    Set oGeneralNotes = invDoc.ActiveSheet.DrawingNotes.GeneralNotes

    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

    'Set text location and create textbox
    Dim oGeneralNote As GeneralNote
    Set oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(65, 50), stext)
End Sub

Hi, I have made some changes in your code. The above code is fine. i need this for all sheets. But text height should be 5mm . now its coming 3.5mm only by default with tahoma