Attribute VB_Name = "CommonNotes1"
' --------------------------------------------------------------------03/08/2007
' CommonNotes.swp                   Written by Leonard Kikstra,
'                                   Copyright 2003-2007, Leonard Kikstra
'                                   Downloaded from Lenny's SolidWorks Resources
'                                        at http://www.lennyworks.com/solidworks
' ------------------------------------------------------------------------------
' CommonNotes1:     Macro is launched from "main" subroutine in this module
' ------------------------------------------------------------------------------
' Notes:            As written, insertion point ust be selected before launching
'                       this macro, and document must be a SolidWorks drawing.
' ------------------------------------------------------------------------------
Global swApp        As Object
Global Document     As Object
Global boolstatus   As Boolean
Global longstatus   As Long
Global SelMgr       As Object
Global PickPt       As Variant
Global CustomNote   As String
Global Const swDocDRAWING = 3               ' Consistent with swconst.bas
Global Const version = 2.55

Sub main()
  Set swApp = Application.SldWorks          ' Attach to SolidWorks
  Set Document = swApp.ActiveDoc            ' Get active document
  If Not Document Is Nothing Then           ' Document is valid
    FileTyp = Document.GetType              ' Get document type
    If FileTyp = swDocDRAWING Then          ' Is it a drawing ?
      PickPt = Document.GetInsertionPoint   ' Get user selected point
      If IsEmpty(PickPt) Then               ' Valid point
        MsgBox "Please pick an insertion point before running macro.", _
               vbExclamation
      Else
        FormSelectNotes.Show                ' Show user form
      End If
    Else
      MsgBox "Current document is not a drawing." & Chr(13) & Chr(13) _
            & "Please load/activate a SolidWorks " & Chr(13) _
            & "drawing and try again.", vbExclamation
    End If
  Else
      MsgBox "No active drawing found in SolidWorks." & Chr(13) & Chr(13) _
            & "Please load/activate a SolidWorks " & Chr(13) _
            & "drawing and try again.", vbExclamation
  End If
End Sub

