add-in difference between office 97 and 03

Ö

Örjan Skoglösa

Hi,

I have written a little macro and saved it as a add-in. It works very
well. I´m running Office 97.

A friend of mine is running Office 2003 and he can´t use it. He says:
Simply adding (from Tools/Add-ons) nothing happens. If I double click on it it will open PP and "test" is there in the list of add-ons. However trying to select it I get the error message "Power Point can't load the requested add-on".

What could be the reason for this?

I paste the code I´m using. Of course I should first go and have a
look at the very useful site where the code comes from, but sadly I
did loose all my bookmarks some months ago.

TIA

Örjan Skoglösa

=====================
code from the macro in the ppt-file I then save as a ppa


Option Explicit

Sub Auto_Open()
Dim oToolbar As CommandBar
Dim oButton As CommandBarButton
Dim MyToolbar As String

' Give the toolbar a name
MyToolbar = "test"

' First, delete the toolbar if it already exists
On Error Resume Next ' so that it doesn't stop on the next line
if the toolbar doesn't exist
Application.CommandBars(MyToolbar).Delete
On Error GoTo errorhandler ' turns error handling back on

' Build the command bar
Set oToolbar = CommandBars.Add(Name:=MyToolbar,
Position:=msoBarFloating, Temporary:=True)

' Now add a button to the new toolbar
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)

' And set some of the button's properties
With oButton

.DescriptionText = "Click" 'Tooltip text when mouse if placed
over button
.Caption = "test" 'Text if Text in Icon is chosen
.OnAction = "test" 'Runs the Sub Button1() code when clicked
.Style = msoButtonCaption ' Button displays as icon, not text
or both
'.FaceId = 52 '52 is my favorite pig; chooses icon #52 from
the available Office icons

End With

' Repeat the above for as many more buttons as you need to add
' Be sure to change the .OnAction property at least for each new
button

' You can set the toolbar position and visibility here if you like
oToolbar.Top = 10
oToolbar.Left = 10

oToolbar.Visible = True

Exit Sub ' so it doesn't go on to run the errorhandler code

errorhandler:
'Just in case there is an error
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
Sub Auto_Close()
'This will run when PowerPoint closes and it will delete the toolbar.
Dim oToolbar As CommandBar
Dim MyToolbar As String
' Note: MyToolbar should be the same value here as in the code
that created the toolbar
MyToolbar = "test"
On Error Resume Next
Application.CommandBars(MyToolbar).Delete
End Sub

Sub test()
MsgBox "test"
End Sub
 
S

Shyam Pillai

Check the macro security level settings on 2003. By default it's on High
which prevents add-ins from loading. Change it to Medium and try again.
 
Ö

Örjan Skoglösa

Hi Shyam,

Perfect! That did it.

BR,
Örjan

PS. I´m not very attendant to this group as the traffic is a bit to
intense for my capacity, but everytime I go here with a question, I
nearly always get a very precise and to-the-point solution from you.
Very impressive. Thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top