Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4069800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:32:46+00:00 2026-05-20T16:32:46+00:00

I want to notify the user of the macro if something went wrong during

  • 0

I want to notify the user of the macro if something went wrong during the execution of the macro. I was wondering if it would be possible to add an item to the Visual Studio error list?

It is possible to do so from within an AddIn (like here), but I would like to do the same thing from a macro.

Edit


To further clarify what i want to achive, here is the sample from the Samples macro library (Alt+F8 -> Samples -> Utilities -> SaveView())

Sub SaveView()
    Dim name As String

    name = InputBox("Enter the name you want to save as:", "Save window layout")
    If (name = "") Then
        MsgBox("Empty string, enter a valid name.")
    Else
        DTE.WindowConfigurations.Add(name)
    End If
End Sub

Instead of the MsgBox(“…”) alert I want to put the error into the VS error list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:32:46+00:00Added an answer on May 20, 2026 at 4:32 pm

    You can add an item in the Task List easily from your macro. Just use the AddTaskToList method from that article and change m_objDTE to DTE. I’ve tried it and it worked.

    However, adding the item in Error List, is probably impossible. You need to call VS services, see how adding an error is done in an add-in. I created a macro from this code and it didn’t work. In general, VS services don’t work in macros. I was able to create ErrorListProvider successfully. I could access it’s methods and properties. But calling ErrorListProvider.Task.Add caused COM exception. If you want to play with it, several notes:
    As described in the article, you need to get 4 assemblies out of the GAC e.g. to c:\dlls\ directory. Since Macros IDE doesn’t allow you to browse when you Add Reference, you need to copy these dlls into …\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies directory (change the 10.0 to your VS version). Then, when you Add Reference in Macros IDE, you should see the assemblies.

    The GetService function always returned Nothing. Add the following field to the class:

    Private serviceProvider As IServiceProvider = New Microsoft.VisualStudio.Shell.ServiceProvider(CType(DTE, Microsoft.VisualStudio.OLE.Interop.IServiceProvider))
    

    and in GetService function change line:

    objService = Microsoft.VisualStudio.Shell.Package.GetGlobalService(serviceType)
    

    to

    objService = serviceProvider.GetService(serviceType)
    

    As I wrote, everything seems OK then but ErrorListProvider.Task.Add fails.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to notify an user using Chrome browser. I need something powerful like
I want to notify the user about something after some specific time. Are there
I want to notify user of mobile as particular event take place,Using notification bar
1/I don't want to notify user if this one is already running my app
I want to notify the administrator when the user change his profile (for example,
In my app, there is service running on background. I want to notify user
I want to notify a user that he has reached a minimum value. The
I want to notify the user of my app when he receives special news
I want to notify the user as soon as the session expires.. an alert
In my application I want to notify the user with the ShellToast . Just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.