Macro Visual Studio 2008 only works with the Macro IDE, not with the Macro Explorer

Edit: Creating a new module in one VSMacros project fixes the problem.


The following macro only works if I open the Macro IDE from Visual Studio and run the macro from there.

It would be much more useful if I could just click the macro macro from the macro browser from my Visual Studio instance.

I should be doing something clearly wrong, but I have never worked with VS macros before. MessageBox does not appear in both cases.

Option Strict Off Option Explicit Off Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Imports System.Security.Principal Imports System.Windows.Forms Public Module AttachToSdtProcess Sub AttachToSdtProcess() Try 'If MessageBox.Show("Attach to SDT.exe", "Caption", _ ' MessageBoxButtons.OKCancel) = DialogResult.Cancel Then 'Return 'End If Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default") Dim compName As String = WindowsIdentity.GetCurrent().Name compName = compName.Substring(0, compName.IndexOf("\")) Dim proc2 As EnvDTE80.Process2 = _ dbg2.GetProcesses(trans, compName).Item("TheExecutable.exe") If proc2 Is Nothing Then MessageBox.Show("Could not find TheExecutable.exe") End If proc2.Attach2(dbgeng) Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub End Module 
+4
source share
2 answers

From this article on MSDN. I think I found another possible answer. The main proposal for this topic was:

In the "Tools", "Options", "Add-ons / Macros" section, select the "Allow macros execution" checkbox

+1
source

In the macro editor there is a message:

 MsgBox("Your Text Here") = Resultxx 

Good luck.

0
source

All Articles