Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia V5 Drawing Sheet Counting

Status
Not open for further replies.

Daniel Popa

Automotive
Sep 23, 2016
19
0
0
GB
Hello

I was using a macro to count the sheets of a drawing and label them properly but I had 4 of them, one for each drawing size.
I want to use VBA and create a user form from which you can select the drawing size and it would automatically run the correct script.
However, since i moved the script into VBA it is not working anymore.
The Code:
Code:
Private Sub A0Button_Click()
Set drawingDocument1 = CATIA.ActiveDocument
j = drawingDocument1.Sheets.Count

Dim oDoc As DrawingDocument
Dim oBackground As DrawingView
Dim oFrontview As DrawingView
Dim oText As DrawingText

Set oDoc = CATIA.ActiveDocument
Set drawingSheets1 = drawingDocument1.Sheets

For i = 1 To drawingDocument1.Sheets.Count
Set oSheet = drawingDocument1.Sheets.Item(i)
oSheet.Activate

Set oBackground = oDoc.Sheets.ActiveSheet.Views.Item("Background View")
Set oText = oBackground.Text.Add("0" & i & " OF " & "0" & j & " " & strNewName, 1029, 57)

Next

End Sub

The error comes up on
Code:
Set oText = oBackground.Text.Add("0" & i & " OF " & "0" & j & " " & strNewName, 1029, 57)
with the message: Run-time error `438`: Object doesn`t support this property or method.

Does anyone know a solution to solve this?


Thank you.
 
Status
Not open for further replies.
Back
Top