• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

installer for office add-ins

I would like to be able to deploy my office add-ins to my customers by programmatically installing them pm their PCs. i.e. without having to ask my customers to perform complex operations. Does it exist a (free?) generic office add-in installer that does the trick? It should obviously work for every version of Windows and Office. If not, which are the important things to take care of so that I can programmatically install my office add-ins? I was thinking of add-in folders, security settings, etc.
0
s_federici
Asked:
s_federici
  • 17
  • 13
  • +1
1 Solution
 
bruintjeCommented:
Hi s_federici,
----------

You could look at an installer program like InstallShield Express
for VS 2003 and 2005 there is VSTO which comes with an installer for .NET addin's

basically all the headaches of what and when to include is better left to an installer program which creates a setup or msi for your clients

----------
bruintje
share what you know, learn what you don't
0
 
s_federiciAuthor Commented:
Does InstallShield Express automatically know where to put all the add-in stuff so that it will work for every version of Windows-Office? I read of VSTO, but I couldn't find any clear instructions on how to use to to deliver an Office (MS Word in my case) add-in.
0
 
fadlounCommented:
Hello
if this addin is a dll file,any installer could handle it ,becuase all required steps to install this addin on your customer machine is copying the dll file and register it. no matter where the dll location is.
I have done this before ,using innosetup :
Source: "esp.dll"; DestDir: "{app}"; Flags: regserver
it works just fine.
regards
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
s_federiciAuthor Commented:
My add-in will have to "show up" in an Office application (e.g. Word) as a toolbar/button visible each time the application is launched. This is my big trouble. Do you have an example of how to achieve this? That would be of great help to me.
0
 
junglerover77Commented:
Please have a look at this:

http://support.microsoft.com/?kbid=238228

Go to topic "Building a COM add-in by using implements" and you will find your answer.

Regards,
Jungle
0
 
fadlounCommented:
hi
I am confused,are you asking to develop an addin with this specification OR your addin is ready and you ask how to deploy it...?
if your addin ready and developed, how did you create it ,,,, ?

regards
0
 
s_federiciAuthor Commented:
I have developed several Visual Basic subs with the Visual Basic for Applications editor included in Word 2000. One sub will create the toolbar/buttons structure. The other subs are linked to the toolbar buttons so that they will be called whenever the user will select the appropriate toolbar buttons.

I would like to deploy this solution to my customers. I would like to be able to automatize the deployment procedure with an installer that will move all the necessary .bas etc files to the customer PC. My customer should be able to see the new toolbar as soon as they start MS Word. The deployment procedure should be able to achieve this result for every Windows OS and every Office version. I need clear explanations on how to get this done.
0
 
s_federiciAuthor Commented:
any other comment fadloun after my clarifications?
0
 
fadlounCommented:
Hello

sorry federici
I have no info regarding this, coz all addin I have created,I create them using visual basic 6,which produce single registerable dll file,if you want to move your addin to VB I am ready to help ;)

BR,

0
 
s_federiciAuthor Commented:
I have VB6. I have VB subs that will create the toolbar structure I need and will do the addin work. I just need info on how to create a registerable dll. I need this dll be installed on my customers's PC and be automatically loaded and run by MS Word (97, 2000, 2004, ecc).
0
 
s_federiciAuthor Commented:
Please, fadloun, could you send me directions on how to create a registrable dll with VB6? Thanks.
0
 
fadlounCommented:
Hello
I will guide you to create a simple addin using visual basic ,this addin is a toolbar with tow button

step 1
in VB IDE go to file then new
from the popup screen choose Addin

step 2
from Project window >>> Designers >>>open connect window
in Addin Display Name type "TestAddin"
choose microsoft word from the drop down application
choose word version from application version
choose startup from initial load behavior

step 3
make sure that those referances are checked in you referance window
Microsoft Word 11 object....( 11 mean Office2003)
Mircrosoft Office 11 Object

Step 4
open Connect Code Window
Past this code

---------Codes-------------
 
Implements IDTExtensibility2

Private WithEvents Field1 As Office.CommandBarButton
Private WithEvents Field2 As Office.CommandBarButton


Dim myBar As Office.CommandBar
Dim myBtn


Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)

End Sub

Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)

End Sub

Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)


On Error GoTo ErrLoad

For Each myBar In Word.Application.CommandBars
    If myBar.Name = "TestBar" Then myBar.Delete
Next

Set TAddin = AddInInst


Set myBar = CommandBars.Add("TestBar")
myBar.Visible = True
myBar.Position = msoBarTop

Set Field2 = myBar.Controls.Add(1)
With Field2
    .Caption = "TestMe2."
    .ToolTipText = "This is just a First test "
    .Style = msoButtonCaption
End With
Set Field1 = myBar.Controls.Add(1)
With Field1
    .Caption = "TestMe1."
    .ToolTipText = "This is just a second  test"
    .Style = msoButtonCaption
End With

Exit Sub
ErrLoad:
MsgBox Err.Description
End Sub


Private Sub Field1_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
frmAddIn.Show 1
End Sub
Private Sub Field2_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    MsgBox "If you have a function place it here"
End Sub


Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)

End Sub

Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)

End Sub
'---------------------CodeEnd-----------------
0
 
fadlounCommented:
Oh god
I forgot to mention that after doing all of that go to file the choose Make MyAddin.dll
this will create the dll file and automatically registerit
now open Word and test the new Bar , its name "TestBar"

on other computers take this file and register it using installer or manually
Manual registering dll
go to start
run
type : regsvr32 "your dll path"

BR,
0
 
s_federiciAuthor Commented:
For my needs, I will have to create an installer for the dll. Someone mentioned Inno. Do you have a favorite (and easy to use) installer? I'm going to test everything. Thanks for now.
0
 
fadlounCommented:
there are a lot of installer but the best free one I know is InNoSetup ( it is really easy to use)
also you can do it using batch file ,running the batch file will copy it to client destination directory and then register it  but in this case you have to ship 2 files the dll one and the bat one , if you need a help regarding any of those tow method just post.
0
 
s_federiciAuthor Commented:
I followed the steps you gave me. At step 4 (paste) I REPLACED all the default code that I found in the code window with the one you sent me. When trying "make myaddin.dll" I get the following error message

Object does not source automation event

In my references I have

Microsoft Word 9.0 Object Library (Office 2000)
Microsoft Office 8.0 Object Library

Can this be the source of the problem?



0
 
fadlounCommented:
I never deal with Office 8.0 Library , I am almost sure that it is referances Issue ,coz I have tested the code and it works just fine with office2003 (office11) ,anyway could you tell me if vb indicate to a specific line when showing this error message ?
0
 
s_federiciAuthor Commented:
VB was highlighting the "WithEvents Field1 As Office.CommandBarButton" part of the second line

Private WithEvents Field1 As Office.CommandBarButton

I found a way to replace the "Microsoft Office 8.0 Object Library" (that I suspect belongs to office 97 that I also have on my PC) with the "Microsoft Office 9.0 Object Library". This time VB stops and highlights the "myBar As Office.CommandBar" part of line

Dim myBar As Office.CommandBar

with the following error message

User-defined type not defined.
0
 
s_federiciAuthor Commented:
No clues?
0
 
fadlounCommented:
Hellooo

Actually I don't know why vb showing this error message because "Microsoft Office 9.0 Object Library" support OfficeCommandBar .I am almost sure about that coz the first Addin I created was on Office2000 machine

in your connect screen what is the application version you are connecting to ?
and could you list all checked referances
0
 
s_federiciAuthor Commented:
Don't know why, but "Microsoft office 9.0 Object Library" wasn't in the list! And I explicitely looked for it... now the compilation steps goes ahead and stops only with a compile error "method or data member not found" at line

Connect.Hide

of the following code

Public VBInstance As VBIDE.VBE
Public Connect As Connect

Option Explicit

Private Sub CancelButton_Click()
    Connect.Hide
End Sub

Private Sub OKButton_Click()
    MsgBox "AddIn operation on: " & VBInstance.FullName
End Sub

Thanks a lot fadloun and... hope you will be able to guide me till the end of this dll creation process!
0
 
fadlounCommented:
remove this line ,in this sample it doesn't have an effection
0
 
s_federiciAuthor Commented:
OK! dll is now ready. I'm going to try the installer step
0
 
fadlounCommented:
if you want to just check out how registering this dll do the job , just copy it to another machine and run regsvr32  ( Manual registeration)
One point I forgot to mention to , when creating an addin using vb this addin will work on the same office version and newer one ,on the older one it wont work ( it is because vb upgrading it is liberary automatically) , in another word if this addin created to connect to Office 11 it wont work on office 10, on the other hand if it is created to connect to office 10 it will work on office 11,
 hope got the point

regards
0
 
s_federiciAuthor Commented:
> on the older one it wont work

Reasonable
0
 
s_federiciAuthor Commented:
The inno installer worked very well on my Office 2000. Would you mind trying it on your Office 2003? You can downloaded it from http://www.sitibs.com/files/stefano/setup.exe
0
 
fadlounCommented:
it works perfectly.
0
 
s_federiciAuthor Commented:
Great! Now, even if I do have VB6, I'm not a VB6 developer. Would you mind commenting on the VB code you asked me to paste into the VB code window? Even a short explanation could be a start for me. Thanks.
0
 
fadlounCommented:
'---------Codes-------------
 
Implements IDTExtensibility2 'whatever addin you are creating keep this line ( this line to implement com addin interface

'Declaring the two buttons will be created on the toolbar ,using withevents to check those buttons event (click event in this example)
Private WithEvents Field1 As Office.CommandBarButton
Private WithEvents Field2 As Office.CommandBarButton

'this is the toolbar declaration
Dim myBar As Office.CommandBar
Dim myBtn 'not required in this sample ,I forgot to remove this line

'this sub is required even it is empty,( I don't want to go deeply in IDTExtensibility2 Implementation)
Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)

End Sub
'This sub is required also ,fired when the com addin going to shutdown
Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)

End Sub

'This sub is fired when you open Word ,it is connecting to registered addin
Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)

'this to rise errors
On Error GoTo ErrLoad

'I prefer to recreate the toolbar each time word opening ,to avoid any mistake could take our toolbar away ,for example the user could delete the bar so we are searching for it ,deleting it then creating it again
'Now searching for our toolbar,if found delete
For Each myBar In Word.Application.CommandBars
    If myBar.Name = "TestBar" Then myBar.Delete
Next

Set TAddin = AddInInst 'not required

'creating the bar
Set myBar = CommandBars.Add("TestBar")
myBar.Visible = True 'set bar visible
myBar.Position = msoBarTop 'set posistion to top

'creating field2 button
Set Field2 = myBar.Controls.Add(1)
With Field2
    .Caption = "TestMe2."  'setting the caption
    .ToolTipText = "This is just a First test " 'setting tooltiptext(when mouse stop over the button
    .Style = msoButtonCaption 'there are various style of buttons ,this is normal one
End With
'same field2 comments
Set Field1 = myBar.Controls.Add(1)
With Field1
    .Caption = "TestMe1."
    .ToolTipText = "This is just a second  test"
    .Style = msoButtonCaption
End With

Exit Sub
ErrLoad:
MsgBox Err.Description 'Error rising
End Sub

'this sub fired when user click on field1 button
Private Sub Field1_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
frmAddIn.Show 1
End Sub
'this sub fired when user click on field2 button
Private Sub Field2_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    MsgBox "If you have a function place it here"
End Sub

'Required for  implement IDTExtensibility2
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)

End Sub

'Required for  implement IDTExtensibility2
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)

End Sub
'---------------------CodeEnd-----------------


BR,
0
 
s_federiciAuthor Commented:
Thanks a lot for the light you shed on the code.
Do you know of a link from which I can learn about the IDTExtensibility2 interface?
0
 
s_federiciAuthor Commented:
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 17
  • 13
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now