Converting Macro to 64 bit

I created a couple of macros to help with custom properties a couple of years ago.  They were created in SW 2009 and run on Windows XP 32 bit and now Solidworks 2010. We also have MS Office 2000 on these computers.

I am working on our new computer setup which will be Windows 7, Solidworks 2010 and  Office 2010.

The macros stop at a string command. strResFilename = Left(strFilename, Len(strFilename) - 7)

And a compile error says “Can’t find project or library”.

Looking at Tools/References I see “Missing: Solidworks 2009 Commands type library.”

Comparing this to the 32 bit computer “Solidworks 2010 Commands type library is selected.  I assume this is part of the problem.

However I do not have a Solidworks 2010 Commands type library available on the the 64 bit computer.

I don’t know what to look for or where to find it.  Am I on the right track with the references?

Is there an easy solution to my problem?

Here is one of the macros that allows users to edit madel properties while in the a drawing.  Then it copies some of the properties to the drawing properties.

Option Explicit

Dim swApp As SldWorks.SldWorks
Dim oDwg As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim lRetVal As Long
Dim sModelName As String
Dim sName As String
Dim sValue As String
Dim lType As Long
Dim bRetVal As Boolean
Dim strFilename As String
Dim strResFilename As String
Dim bolCheck As Boolean
Dim intCount As Integer
Dim strModString As String
Dim strDoRebuild As String


Sub main()

On Error Resume Next

Set swApp = CreateObject("SldWorks.Application")
'Set swApp = Application.SldWorks

Set oDwg = swApp.ActiveDoc

'test to see if a drawing file is open
If (oDwg Is Nothing) Or (oDwg.GetType <> swDocDRAWING) Then
        MsgBox "You must have a drawing active before running this program.", vbCritical, "Oops"
    Exit Sub
End If

'We assume here a simple case of the first view referring to the desired model
'The first view returned is the sheet--we'll skip that one
Set swView = oDwg.GetFirstView
'swView.ReferencedDocument.FileSummaryInfo


Set swView = swView.GetNextView
'open the property dialog for the model

'Get the File Name of the Part
strFilename = swView.ReferencedDocument.GetPathName

bolCheck = False
intCount = 1

strResFilename = Left(strFilename, Len(strFilename) - 7)

Do While bolCheck = False
strModString = Right(strResFilename, intCount)
If Left(strModString, 1) = "\\" Then
strResFilename = Right(strResFilename, intCount - 1)
bolCheck = True
Else
intCount = intCount + 1
End If
Loop
'-----------------------------------------

swView.ReferencedDocument.FileSummaryInfo


'------------------------------------
'Copy the part number property from the model filename to the drawing
sName = "Part Number"
lType = swView.ReferencedDocument.GetCustomInfoType3("", sName)
'Delete property if it already exists in the drawing
bRetVal = oDwg.DeleteCustomInfo2("", sName)
'add the new property
bRetVal = oDwg.AddCustomInfo3("", sName, lType, strResFilename)

'-----------------------------------
'Copy the description property from the model to the drawing
sName = "Description"
'get the custom property value and type from the model
sValue = swView.ReferencedDocument.CustomInfo2("", sName)
lType = swView.ReferencedDocument.GetCustomInfoType3("", sName)
        
'Delete property if it already exists in the drawing
bRetVal = oDwg.DeleteCustomInfo2("", sName)
'add the new property
bRetVal = oDwg.AddCustomInfo3("", sName, lType, sValue)

'-----------------------------------
'Copy the description property from the model to the drawing
sName = "Manufacture"
'get the custom property value and type from the model
sValue = swView.ReferencedDocument.CustomInfo2("", sName)
lType = swView.ReferencedDocument.GetCustomInfoType3("", sName)
        
'Delete property if it already exists in the drawing
bRetVal = oDwg.DeleteCustomInfo2("", sName)
'add the new property
bRetVal = oDwg.AddCustomInfo3("", sName, lType, sValue)

'-----------------------------------
'Copy the description property from the model to the drawing
sName = "Manufacture Part Number"
'get the custom property value and type from the model
sValue = swView.ReferencedDocument.CustomInfo2("", sName)
lType = swView.ReferencedDocument.GetCustomInfoType3("", sName)
        
'Delete property if it already exists in the drawing
bRetVal = oDwg.DeleteCustomInfo2("", sName)
'add the new property
bRetVal = oDwg.AddCustomInfo3("", sName, lType, sValue)

'-----------------------------------
'Copy the description property from the model to the drawing
sName = "Manufacture Part Desc"
'get the custom property value and type from the model
sValue = swView.ReferencedDocument.CustomInfo2("", sName)
lType = swView.ReferencedDocument.GetCustomInfoType3("", sName)
        
'Delete property if it already exists in the drawing
bRetVal = oDwg.DeleteCustomInfo2("", sName)
'add the new property
bRetVal = oDwg.AddCustomInfo3("", sName, lType, sValue)

strDoRebuild = MsgBox("Rebuild drawing now?", vbYesNo)

If strDoRebuild = vbYes Then
    oDwg.ForceRebuild
End If
 
'code to add custom property to the model
'not needed in this macro
' sName = "test"
' bRetVal = swView.ReferencedDocument.AddCustomInfo3("", sName, lType, "xx")

Set swView = Nothing
Set oDwg = Nothing
Set swApp = Nothing


 
End Sub

SolidworksApi macros