Daniel Popa
Automotive
- Sep 23, 2016
- 19
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:
The error comes up on
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.
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)
Does anyone know a solution to solve this?
Thank you.