+ Reply to Thread
Results 1 to 4 of 4

Ensure Addin is loaded properly by user - no double clicking

Hybrid View

  1. #1
    Rich
    Guest

    Ensure Addin is loaded properly by user - no double clicking

    Hi,

    I want to prevent users double-clicking to load my add-in. I would like a
    warning to appear telling them how to install it properly.

    I can detect whether Workbook_AddinInstall() has executed (code below),
    which is great EXCEPT:
    When the user opens excel with the add-in already installed, it does not
    execute again, and my warning comes up.

    Any ideas?

    Thanks
    Rich

    Option Explicit
    Dim AddInLoad As Boolean

    Private Sub Workbook_AddinInstall()
    AddInLoad = True
    End Sub

    Private Sub Workbook_Open()
    If AddInLoad Then
    If ThisWorkbook.IsAddin Then
    MsgBox "add In - all cool"
    Else
    MsgBox "Not really sure if this is possible"
    End If
    Else
    If ThisWorkbook.IsAddin Then
    MsgBox "addin loaded badly, warning and exit"
    Else
    MsgBox "Spreadsheet only"
    End If
    End If
    End Sub



  2. #2
    Rich
    Guest

    Re: Ensure Addin is loaded properly by user - no double clicking

    Oh go on, somebody must know _something_
    Rich

    "Rich" <r@r.r> wrote in message
    news:42947b78$0$28793$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    > Hi,
    >
    > I want to prevent users double-clicking to load my add-in. I would like a
    > warning to appear telling them how to install it properly.
    >
    > I can detect whether Workbook_AddinInstall() has executed (code below),
    > which is great EXCEPT:
    > When the user opens excel with the add-in already installed, it does not
    > execute again, and my warning comes up.
    >
    > Any ideas?
    >
    > Thanks
    > Rich
    >
    > Option Explicit
    > Dim AddInLoad As Boolean
    >
    > Private Sub Workbook_AddinInstall()
    > AddInLoad = True
    > End Sub
    >
    > Private Sub Workbook_Open()
    > If AddInLoad Then
    > If ThisWorkbook.IsAddin Then
    > MsgBox "add In - all cool"
    > Else
    > MsgBox "Not really sure if this is possible"
    > End If
    > Else
    > If ThisWorkbook.IsAddin Then
    > MsgBox "addin loaded badly, warning and exit"
    > Else
    > MsgBox "Spreadsheet only"
    > End If
    > End If
    > End Sub
    >
    >




  3. #3
    Peter T
    Guest

    Re: Ensure Addin is loaded properly by user - no double clicking

    Hi Rich,

    try something like this:

    Private Sub Workbook_Open()
    Dim oAdn As AddIn

    On Error Resume Next
    Set oAdn = AddIns(ThisWorkbook.Title)
    On Error GoTo errH
    If oAdn Is Nothing Then
    Set oAdn = AddIns.Add(ThisWorkbook.FullName)
    End If

    If (Not oAdn.Installed) Then
    oAdn.Installed = True
    MsgBox ThisWorkbook.Title & " in Addin manager & checked"
    Exit Sub

    errH:
    'something gone wrong !!
    End Sub

    Before saving, in thisworkbook properties temporarily set IsAddin to False.
    In Excel goto File properties. Enter a friendly name in Title and a brief
    description in Comments. Reset IsAddin to True.

    Regards,
    Peter T

    "Rich" <r@r.r> wrote in message
    news:42947b78$0$28793$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    > Hi,
    >
    > I want to prevent users double-clicking to load my add-in. I would like a
    > warning to appear telling them how to install it properly.
    >
    > I can detect whether Workbook_AddinInstall() has executed (code below),
    > which is great EXCEPT:
    > When the user opens excel with the add-in already installed, it does not
    > execute again, and my warning comes up.
    >
    > Any ideas?
    >
    > Thanks
    > Rich
    >
    > Option Explicit
    > Dim AddInLoad As Boolean
    >
    > Private Sub Workbook_AddinInstall()
    > AddInLoad = True
    > End Sub
    >
    > Private Sub Workbook_Open()
    > If AddInLoad Then
    > If ThisWorkbook.IsAddin Then
    > MsgBox "add In - all cool"
    > Else
    > MsgBox "Not really sure if this is possible"
    > End If
    > Else
    > If ThisWorkbook.IsAddin Then
    > MsgBox "addin loaded badly, warning and exit"
    > Else
    > MsgBox "Spreadsheet only"
    > End If
    > End If
    > End Sub
    >
    >




  4. #4
    Rich
    Guest

    Re: Ensure Addin is loaded properly by user - no double clicking

    Hey Peter, thans for the that, I was working on a similar track, but a bit
    different, put the two together and I am (nearly) there, still a few things
    to iron out, but looking good, thanks



    "Peter T" <peter_t@discussions> wrote in message
    news:%23L25LjpYFHA.712@TK2MSFTNGP14.phx.gbl...
    > Hi Rich,
    >
    > try something like this:
    >
    > Private Sub Workbook_Open()
    > Dim oAdn As AddIn
    >
    > On Error Resume Next
    > Set oAdn = AddIns(ThisWorkbook.Title)
    > On Error GoTo errH
    > If oAdn Is Nothing Then
    > Set oAdn = AddIns.Add(ThisWorkbook.FullName)
    > End If
    >
    > If (Not oAdn.Installed) Then
    > oAdn.Installed = True
    > MsgBox ThisWorkbook.Title & " in Addin manager & checked"
    > Exit Sub
    >
    > errH:
    > 'something gone wrong !!
    > End Sub
    >
    > Before saving, in thisworkbook properties temporarily set IsAddin to

    False.
    > In Excel goto File properties. Enter a friendly name in Title and a brief
    > description in Comments. Reset IsAddin to True.
    >
    > Regards,
    > Peter T
    >
    > "Rich" <r@r.r> wrote in message
    > news:42947b78$0$28793$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    > > Hi,
    > >
    > > I want to prevent users double-clicking to load my add-in. I would like

    a
    > > warning to appear telling them how to install it properly.
    > >
    > > I can detect whether Workbook_AddinInstall() has executed (code below),
    > > which is great EXCEPT:
    > > When the user opens excel with the add-in already installed, it does not
    > > execute again, and my warning comes up.
    > >
    > > Any ideas?
    > >
    > > Thanks
    > > Rich
    > >
    > > Option Explicit
    > > Dim AddInLoad As Boolean
    > >
    > > Private Sub Workbook_AddinInstall()
    > > AddInLoad = True
    > > End Sub
    > >
    > > Private Sub Workbook_Open()
    > > If AddInLoad Then
    > > If ThisWorkbook.IsAddin Then
    > > MsgBox "add In - all cool"
    > > Else
    > > MsgBox "Not really sure if this is possible"
    > > End If
    > > Else
    > > If ThisWorkbook.IsAddin Then
    > > MsgBox "addin loaded badly, warning and exit"
    > > Else
    > > MsgBox "Spreadsheet only"
    > > End If
    > > End If
    > > End Sub
    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1