Dear all,
i have created a vba for generating drawing notes using autodesk inventor
almost of the vba is done, but the program lines given below are having some error
Please help me in correcting this........
Thanks & Regards
venkatramreddyp
*********************************************
Option Explicit
Global Const version = 2.55
Global Const sDataFilePathAndName = "F:\venkat\inventor\latest\catia\CommonNotes.ini"
Global InvApp As Application
Global InvDoc As Document
Global DrawDoc1 As DrawingDocument
Global vDoc1 As Variant
Global DrawSheets1 As DrawingSheets
Global DrawSheet1 As DrawingSheet
Global DrawViews1 As DrawingViews
Global DrawView1 As DrawingView
Global DrawTexts1 As DrawingTexts
Global DrawText1 As DrawingText
Global DrawLeader1 As DrawingLeader
Global sFileType As String
Global bMainViewIsActive
Global Selection1
Global sStatus1 As String
Global PointLocation1(1)
Global bStatus As Boolean
Global CustomNote As String
Sub INVmain()
Dim InvApp As Inventor.Application
Set InvApp = ThisApplication
On Error Resume Next
Set InvDoc = InvApp.ActiveDocument
On Error GoTo 0
If Not (InvDoc Is Nothing) Then
sFileType = TypeName(InvDoc)
If sFileType = "DrawingDocument" Then
Set DrawDoc1 = InvDoc
Set DrawSheets1 = DrawDoc1.Sheets
Set DrawSheet1 = DrawSheets1.ActiveSheet
Set DrawViews1 = DrawSheet1.Views
Set DrawView1 = DrawViews1.ActiveView
Set DrawTexts1 = DrawView1.Texts
If (DrawView1.Name = "Main View") Then
bMainViewIsActive = True
Else
bMainViewIsActive = False
End If
Set Selection1 = DrawDoc1.Selection
If (Selection1.Count 1) Then
Selection1.Clear
Load frmStatus
frmStatus.txtSelect.Text = "Select Note Insertion Point"
frmStatus.Show vbModeless
DoEvents
End If
Set vDoc1 = DrawDoc1
sStatus1 = vDoc1.Indicate2D("Select Note Insertion Point", PointLocation1)
frmStatus.Hide
DoEvents
If (sStatus1 = "Cancel") Then
Unload frmStatus
Exit Sub
End If
FormSelectNotes.Show vbModal
Else
MsgBox "Current document is not a Drawing." & Chr(13) & Chr(13) _
& "Please load/activate a Catia " & Chr(13) _
& "drawing and try again.", vbExclamation
End If
Else
MsgBox "No active Drawing found in Catia." & Chr(13) & Chr(13) _
& "Please load/activate a Catia " & Chr(13) _
& "drawing and try again.", vbExclamation
End If
End Sub