AnsweredAssumed Answered

Recorded macro fails when run?

Question asked by P. Farnham on Apr 5, 2015
Latest reply on Apr 8, 2015 by P. Farnham

Solidworks 2015 sp 2.1

 

This is the code that is recorded when setting/de-selecting/setting the Decal option under the view toolbar

But I get a compile error "Method or data member not found" when trying to run it, but hold on, that is what Solidworks recorded!!

Indeed this member "swDisplayDecals" does not exist in the API list and so why would Solidworks record a member that does not exist?

 

Can anyone throw some light on this please?

 

 

' ******************************************************************************
' C:\Users\Pete\AppData\Local\Temp\swx6488\Macro1.swb - macro recorded on 04/05/15 by Pete
' ******************************************************************************
Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _
Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayDecals, True)
boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayDecals, False)
boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayDecals, True)
End Sub

Outcomes