Proper way to turn this macro into an Add Inn in Visual studio.

Proper way to turn this macro into an Add Inn in Visual studio.

davidsUUGCH
Contributor Contributor
480 Views
1 Reply
Message 1 of 2

Proper way to turn this macro into an Add Inn in Visual studio.

davidsUUGCH
Contributor
Contributor

Hello,

 

I am experimenting with turning a macro into a plug in using Visual Studio 2022. this macro is an automated action that happens whenever i export the document.

 

I get error CS1061 when i set the code to use ThisDocument to define the active document in the Model startup.

I also get CS1061 when using the this.shutdown (or startup) int the internal startup.

 

Visual studio offers 3 solutions i was wondering which solution would be the best? i am trying to turn this Macro into an AddIn so we can distribute it better to the rest of the office.

 

Please see the attached screenshots.

 

0 Likes
Accepted solutions (1)
481 Views
1 Reply
Reply (1)
Message 2 of 2

MiguelGT17
Advocate
Advocate
Accepted solution

absolutely, to get the current document in visual studio the syntax change a little bit. Try the following code:

 

UIDocument uidoc = commandData.Application.ActiveUIDocument;

Document doc = uidoc.Document;

0 Likes