AnsweredAssumed Answered

Macro to Flip Flop the placement of the Quantity on a balloon.

Question asked by Joseph Kissling on Feb 3, 2021
Latest reply on Feb 4, 2021 by Josh Brady

I'm trying to write a Macro that flip flops the placement of the quantity on the selected balloon notes. This macro will be mapped to a hotkey as an improvement to my workflow. I've figured out which API commands to use, however, I cannot get them to work with one another. The idea of the program is after the balloon is selected is to determine which side the quantity is placed on, and then switch the placement to the opposite side. I'm getting hung up on the determining which side the quantity is on part, which is posted below. It throws a mismatch error and the documentation is not very helpful. Can y'all provide some guidance?  


Option Explicit

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As ISelectionMgr 'SldWorks.SelectionMgr
Dim swNote As Object
Dim place As Integer

Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
Set swSelMgr = swModel.SelectionManager

' Get the selected balloon
Set swNote = swSelMgr.GetSelectedObject6(1, -1)

place = swNote.QuantityPlacement

' Here goes the flp flop logic'
Debug.Print place

End Sub