5 Replies Latest reply on Feb 11, 2013 3:02 PM by Mike Brainard

    Macros started via Runmacro2 command in C# DLL don't run correctly

    Mike Brainard

      I wrote a C# DLL using VS2010 that starts various macros via the “Runmacro2” command. Since upgrading to SW2013sp2, macros containing userforms do not work correctly, they start but none of the form events fire and the VBA editor becomes un-useable. Macros that don’t have userforms work okay.


      Afterwards all macros of this type do not start correctly even when started by a button or hot-key, the only way to resolve the issue is to restart SW.


      What I mean by the “VBA editor becomes un-useable”

      You cannot access the IDE toolbars or menus and it will stop at breakpoints.


      I use this same method in a VB.Net DLL without problems.


      My macros typically contain one or more userforms and I always start them via a Main procedure as such:


      Public Sub main()

                   Dim thisForm as MYFORM


                   Set thisForm = New MYFORM

                   thisForm.Show vbModal

                   Unload thisForm


                   Set thisForm = Nothing

      End Sub


      My system has VS2010 v10.0.40219.1 sp1 installed, the DLL is compiled targeting .NET Framework 4


      Has anyone else seen this issue?