Display full version of the post: vba for generating drawing notes....some error

venkatramreddyp
03.12.2009, 17:17
Dear all,i have created a vba for generating drawing notes using autodesk inventoralmost of the vba is done, but the program lines given below are having some errorPlease help me in correcting this........Thanks & Regardsvenkatramreddyp *********************************************Option ExplicitGlobal Const version = 2.55Global Const sDataFilePathAndName = "F:\venkat\inventor\latest\catia\CommonNotes.ini"Global InvApp As ApplicationGlobal InvDoc As DocumentGlobal DrawDoc1 As DrawingDocumentGlobal vDoc1 As VariantGlobal DrawSheets1 As DrawingSheetsGlobal DrawSheet1 As DrawingSheetGlobal DrawViews1 As DrawingViewsGlobal DrawView1 As DrawingViewGlobal DrawTexts1 As DrawingTextsGlobal DrawText1 As DrawingTextGlobal DrawLeader1 As DrawingLeaderGlobal sFileType As StringGlobal bMainViewIsActiveGlobal Selection1Global sStatus1 As StringGlobal PointLocation1(1)Global bStatus As BooleanGlobal CustomNote As StringSub INVmain()Dim InvApp As Inventor.ApplicationSet InvApp = ThisApplicationOn Error Resume NextSet InvDoc = InvApp.ActiveDocumentOn Error GoTo 0If Not (InvDoc Is Nothing) ThensFileType = TypeName(InvDoc)If sFileType = "DrawingDocument" ThenSet DrawDoc1 = InvDocSet DrawSheets1 = DrawDoc1.SheetsSet DrawSheet1 = DrawSheets1.ActiveSheetSet DrawViews1 = DrawSheet1.ViewsSet DrawView1 = DrawViews1.ActiveViewSet DrawTexts1 = DrawView1.TextsIf (DrawView1.Name = "Main View") ThenbMainViewIsActive = TrueElsebMainViewIsActive = FalseEnd IfSet Selection1 = DrawDoc1.SelectionIf (Selection1.Count 1) ThenSelection1.ClearLoad frmStatusfrmStatus.txtSelect.Text = "Select Note Insertion Point"frmStatus.Show vbModelessDoEventsEnd IfSet vDoc1 = DrawDoc1sStatus1 = vDoc1.Indicate2D("Select Note Insertion Point", PointLocation1)frmStatus.HideDoEventsIf (sStatus1 = "Cancel") ThenUnload frmStatusExit SubEnd IfFormSelectNotes.Show vbModalElseMsgBox "Current document is not a Drawing." & Chr(13) & Chr(13) _& "Please load/activate a Catia " & Chr(13) _& "drawing and try again.", vbExclamationEnd IfElseMsgBox "No active Drawing found in Catia." & Chr(13) & Chr(13) _& "Please load/activate a Catia " & Chr(13) _& "drawing and try again.", vbExclamationEnd IfEnd Sub