Add-In Express for ... .NET - Developer's Guide

Add-in Express™ Support Service
That's what is more important than anything else

Add-In Express for ... .NET - Developer's Guide
Add-In Express for ... .NET - Developer's Guide 
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, everybody

I am a complete newbie in ADX and I am learning it by hands on experience with your Developer's Guide.

I am working on:
Your First Microsoft Office COM Add-in
Step # 10 - Handling Excel Worksheet Events page 36

I have created ExcelWorksheetEventsClass1.vb

page 36 of the Guide says:

In addition, you change the Activate and Deactivate procedures as follows:

Dim MyEventClass As ExcelWorksheetEventsClass1 = New ExcelWorksheetEventsClass1(Me)
..

Private Sub Deactivate(ByVal sender As Object, ByVal hostObj As Object, _ 
   ByVal window As Object) _ 
   Handles adxWordEvents.WindowDeactivate, adxExcelEvents.WindowDeactivate 
Me.AdxCommandBarButton1.Enabled = False 
Select Case Me.HostName 
   Case "Excel" 
    If MyEventClass.IsConnected Then MyEventClass.RemoveConnection() 

   Case "Word" 
   Case "PowerPoint" 
   Case Else 
   MsgBox(Me.AddinName + " doesn't support " + Me.HostName) 
End Select 

End Sub


----------------------------

My Questions:


Question 1:

I don't find the "Activate" and "Deactivate" procedures.

The closest Sub I can find in ExcelWorksheetEventClass1.vb are:
Public Overrides Sub ProcessActivate()
and
Public Overrides Sub ProcessActivate()

Are these the 2 subs which I am supposed to change?
If not, where should I put these codes?
-------------------------------------------------------

Question 2:
Where do we type this line:
Dim MyEventClass As ExcelWorksheetEventsClass1 = New ExcelWorksheetEventsClass1(Me)
..
?

Right at the top of the class, before the first sub?
If not, then where?

-------------------------------------------------------
Question 3:

Do I have to type the foll. manually? Can they not be inserted automatically? How?

(ByVal sender As Object, ByVal hostObj As Object, _
ByVal window As Object) _
Handles adxWordEvents.WindowDeactivate, adxExcelEvents.WindowDeactivate

-------------
Thanks
leonlai
Posted 20 Dec, 2018 06:51:49 Top
Andrei Smolin


Add-in Express team


Posts: 16670
Joined: 2006-05-11
Hello Leon,

#1 & #2.

Please download the archive containing sample projects at https://www.add-in-express.com/downloads/adxnet.php; see the item labelled "Add-in Express for Office and .NET sample projects".

That section refers to the sample project located in {ZIP}\Documentation Samples\Your First Microsoft Office COM Add-in\VS2010".

#3. There's a way to do this in the IDE. Click the events component to select it. In the Properties window, select an event (e.g. WindowDeactivate) and use the drop down to the right of the field to select the method that will handle this event. You can assign the same method to handle several events. These manipulations are reflected in the method declaration.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Dec, 2018 08:04:11 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

I downloaded your sample, and tried to build it.

But I get the following messages:


Error 1
Couldn't process file AboutForm.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file.
Error 1
Couldn't process file AboutForm.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.
XLToys

Error 2
Couldn't process file AddinModule.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.
XLToys



How do I "Remove the mark of the web ..." ?

Thanks

leonlai
Posted 20 Dec, 2018 08:26:22 Top
Andrei Smolin


Add-in Express team


Posts: 16670
Joined: 2006-05-11
Try this: right-click the ZIP downloaded and click Unlock on the General tab of the Properties window.

Note that I mentioned a different sample project.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Dec, 2018 08:28:47 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Thanks, it works!

Great resource for learning!

Leon
Posted 21 Dec, 2018 01:49:01 Top