VB.NET Addon & RUNMACRO function in Shape Sheet

Started by RhesusMinus, December 01, 2010, 10:49:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RhesusMinus

Hi.

I've created a new Addon for Visio 2010, using the wizard in Visual Studio 2010.

When I build/run the addon, I can see that the DLL is loaded, thanks to two message boxes I've inserted into ThisAddIn.cls
Public Class ThisAddIn

    Private Sub ThisAddIn_Startup() Handles Me.Startup
        MsgBox("Oh yeah!")
    End Sub

    Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        MsgBox("Done!")
    End Sub

End Class


I've also added e new module, named "MyModule", and in this Module I've got the following code:
Module MyModule

    Public Sub MyDoubleClick()
        MsgBox("DoubleClick")
    End Sub

End Module


However.. no matter what I write in the EventDblClick part in the shape sheet, nothing happens. I've tried
RUNADDON("MyDoubleClick"), RUNADDON("MyModule.MyDoubleClick") and many others (including the Solutions name and exclamation marks in various combinations).

I've also had a look at the SDK samples, but couldn't find anything on them there...

Anyone?

THL


aledlund

I'm confused as to why you're not using marker events with your addon. The other questions have to do with is the addon registered with Visio? Is it in the startup or add-on path? Is it a VSL or an EXE.

Example 1
RUNADDON("Calendar.exe")
Launches an add-on called Calendar.exe.

Example 2
RUNADDON("Array Shapes")
Launches the (VSL-implemented) add-on whose name is Array Shapes.


aledlund

another question. where does the 'runmacro' come in? That's vba and unassociated with the addon. I prefer the 'callthis' since I can add parameters to it.
al

RhesusMinus

Thanks for replying Al.

Marker Events? I might use them if I know what they're for  :)

I guess Visual Studio have registered the Add-On for me as it built the DLL. As I wrote, the add-in is loaded in Visio without med doing anything than just running my Visual Studio Solution. I can see this, becaus the msgbox'es in the code fire as expected when starting/ending Visio.

RUNMACRO... typo in the subject :)

THL

aledlund


The format to call something inside an addon looks something like this.

=RUNADDONWARGS("MyAddOn","/cmd=MyDoubleClick")

in case you missed this one

http://msdn.microsoft.com/en-us/library/aa168138(office.11).aspx

al

RhesusMinus

Argh.. so much text to read ;)

But I found this:
COM Add-ins
Cannot be called from the ShapeSheet. However, can monitor for and respond to marker events raised by the QueueMarkerEvent add-on or QueueMarker ShapeSheet function in response to user actions (such as the evaluation of a ShapeSheet cell formula).

So.. now I only have to figure out how to make my add-in check for this QueueMarkerEvent :)

Tips?

THL

aledlund

If you're doing com add-in there are examples in the sdk. Look for AddAdvise. The treeview sample application is a com add-in so testing to see if it compiles and runs should be a good start.
al

RhesusMinus

I'm not getting it to compile. When the DLL is built, Visual Studio says:

File "C:\Program Files\Microsoft Office\Office14\VisSDK\Samples\Treeview\VBNet\Visual Studio 80\bin\x64\Debug\WBSTreeView.dll" is not a valid assembly.

As you see, I'm running this on a 64-bit system. I have done the changes necessary for it to build on a 64-bit platform, like it says in the SDK help files.

I'm not sure what causes the problem, that I run on Windows 7 x64, or that I'm using Visual Studio 2010.

I'm installing a new virtual machine now, were I'll run W7 x86 and Visual Studio 2008. Hopefully I have greater success then.

Can Visio use the same DLL (compiled for AnyCPU) for both x86 and x64 versions, or will I have to make separate DLL's?

THL



aledlund

I'm also on an x64 system with v2010 x86 installed and vs2010.
I followed the text file instructions using vs90 solution rather than the vs80, vs2010 converts the project.
I then built the project (built clean), and then built the setup project (clean), and installed the solution.
I then went to the samples directory and opened the WbsTreeview template (.vst).
The application worked.

Yes you will need two versions of the project for when you are done.

al

RhesusMinus

Hi again Al.

I just wanted to tell you that I'm able to handle the QueueMarkerEvents from the shape sheet now. In both Win 7 x86 and x64. I think I'll continue in the x86 virtual machine, as edit-and-continue still isn't supported on x64 platform.

Thanks for your patience, and I WILL be bothering you again ;)

THL

aledlund