AnsweredAssumed Answered

Having trouble using if statements with axis

Question asked by Matt Sullivan on Mar 7, 2019
Latest reply on Mar 8, 2019 by Matt Sullivan

Hi,

I am trying to create a simple macro but my VBA is very limited and I can't figure out exactly how to fix this code.

I want to be able to run the macro and if the temp axis is "on", turn it off.

and if the temp. axis is "off" then turn it on.

 

Any ideas? Am I not setting up a variable or something??

 

 

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

 

If swUserPreferenceToggle_e.swDisplayAxes = True Then

     boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayAxes, False)

     boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayTemporaryAxes, False)

     End If

 

If swUserPreferenceToggle_e.swDisplayAxes = False Then

     boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayAxes, True)

     boolstatus = Part.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayTemporaryAxes, True)

     End If

 

End Sub

Outcomes