views:

12

answers:

0

I have a macro which runs fine within the Macro Editor but not if run from Visual Studio - either from Macro Explorer or when bound to a key. In either of the last two cases, the Wait cursor appears briefly but the macro has no effect. Since it's the first one I've ever written, I don't know what's wrong. Anyone seen this behaviour before?

Here's the macro:

  Public Module XamlToggle
    Sub XamlToggle()
        Dim p As EnvDTE.Property
        p = DTE.Properties("TextEditor", "Xaml Specific").Item("AttributeFormat")
        If p.Value = "NewLine" Then
            p.Value = "SingleSpace"
        Else
            p.Value = "NewLine"
        End If
    End Sub
End Module

All it does is toggle the Xaml settings between putting everything on one line or many lines when formatting the document.