Ive got a macro that changes the width of my feature tree and it was working right up until I installed SW2018 this week. it works in 2018 but not 2017, (Ive had to switch back to work on a project that's not ready to upgrade to 2018) this is the error I get. Is their anything I can do to make it work in both?
and here is my code. Ive attached my macro as well.
Dim swApp As Object
'----------------------------------------
'
' Preconditions: Model document is open.
'
' Postconditions: Width of FeatureManager design tree is controlled by myWidth (default 400).
'
'----------------------------------------
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim nWidth As Long
Dim NewWidth As Long
Dim nRetVal As Long
Dim myWidth As Integer
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
myWidth = 735
nWidth = swModel.GetFeatureManagerWidth
nRetVal = swModel.SetFeatureManagerWidth(nWidth / nWidth * myWidth)
NewWidth = nWidth / nWidth * myWidth
Debug.Print "File = " & swModel.GetPathName
Debug.Print " Old width = " & nWidth & " pixels"
Debug.Print " New width = " & NewWidth & " pixels"
End Sub
SolidworksApi/macros