workbook_open freezes Excel

Windows 2000
Office XP

I have created an Excel add-in which creates a new menu item on
opening, and deletes it in closing.  The menu works fine on my WinXP /
Office XP machine, and on a number of users' Win2k/Office Xp machines.

However, on certain computers, the add-in causes Excel to freeze on
opening.  I have the following code in the "ThisWorkbook" section:

[START CODE]
Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
RemoveMenu

End Sub

Sub workbook_open()
NewMenu
    
End Sub
[END CODE]


which calls procedure "NewMenu" on open.  "NewMenu" contains the
following code:

[START CODE]
Sub NewMenu()
Dim aMenu As Variant
Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")

aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
aMenu.MenuItems.Add "-"
aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
aMenu.MenuItems.Add "Format Holdings Report",
OnAction:="HoldingReport"

aMenu.MenuItems.Add "-"

aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"

aMenu.MenuItems("Save rating change").Enabled = False
aMenu.MenuItems("Format holdings report").Enabled = False

Select Case GetNetworkName
    Case "tdonovan", "mnakai"
       aMenu.MenuItems("Format holdings report").Enabled = True
    Case "dboyce", "nharris"
        aMenu.MenuItems("Format holdings report").Enabled = True
        aMenu.MenuItems("Save rating change").Enabled = True
End Select
End Sub
[END CODE]

When I open Excel, the IAD menu appears, but Excel freezes, the menus
do not respond, and no "Book1" new file is created.

If I remove the NewMenu command from workbook_open, Excel opens as
normal.  I can the run the workbook_open procedure from VBA with no
problem at all.

I cannot find anything wrong with the code - indeed, there can't be,
as it runs fine when Excel has already been opened.  It is only when
it is run during the opening of Excel, on the Workbook_open event,
that problems occur.

This is a very frustrating problem, not least because the add-in works
fine on a number of other computers running exactly the same versions
of Windows and Office.  If anybody has any suggestions, I would be
very grateful.

Thanks

Dom
0
dom_boyce (3)
10/29/2004 4:19:48 PM
excel.misc 78881 articles. 5 followers. Follow

5 Replies
523 Views

Similar Articles

[PageSpeed] 1

I'd guess that it was a coincidence that excel was locking up, too.

I think I'd do the standard checks first.

A couple of guesses.

1.  Clean up the windows temp folder.  (then test it out)

2.  sometimes the file that holds the customized toolbar settings gets hosed.
    close excel
    windows start button|Find (or search)
    search for *.xlb
    rename them to *.xlbOLD
    restart excel
 
    if it worked, delete the *.xlbOLD files and rebuild any customized toolbars.

    If it didn't, rename them back to *.xlb.

Chip Pearson has some notes to help diagnose startup problems at:
http://www.cpearson.com/excel/StartupErrors.htm

But in xl97, menus were displaced with commandbars.  Menus were still supported
for backward compatibility.  Your code worked ok for me in xl2002, but you may
want to convert it to use commandbars.

This seemed to match what you wanted--I did put the whole thing in a General
module, though you could move things back to workbook_open and _beforeopen.

Option Explicit
Option Base 0
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Sub auto_close()
    Call RemoveMenu
End Sub
Sub auto_open()
    Call NewMenu
End Sub
Sub NewMenu()

Dim myCtrl As CommandBarControl
Dim myBTN As CommandBarButton
Dim myMacs As Variant
Dim myCaps As Variant
Dim iCtr As Variant
Dim OkToShow() As Boolean
Dim myBeginGroup() As Boolean

Call RemoveMenu

myMacs = Array("multexformat", _
               "CreateLabels", _
               "pastevalues", _
               "HoldingReport", _
               "AboutAddin")
               
myCaps = Array("Format for MIDAS", _
               "Create labels", _
               "Save rating change", _
               "Format Holdings Report", _
               "About Add-in")
               
ReDim OkToShow(LBound(myCaps) To UBound(myCaps))
OkToShow(0) = True
OkToShow(1) = True
OkToShow(2) = False
OkToShow(3) = False
OkToShow(4) = True

ReDim myBeginGroup(LBound(myCaps) To UBound(myCaps))
myBeginGroup(0) = False
myBeginGroup(1) = False
myBeginGroup(2) = True
myBeginGroup(3) = False
myBeginGroup(4) = True

Select Case LCase(GetNetworkName)
    Case Is = "tdonovan", "mnakai"
        OkToShow(3) = True
    Case Is = "dboyce", "nharris"
        OkToShow(2) = True
        OkToShow(3) = True
End Select
               
If UBound(myMacs) <> UBound(myCaps) Then
    MsgBox "Design error--not the same number of elements!"
    Exit Sub
End If

With Application.CommandBars(1)
    Set myCtrl = .Controls.Add(Type:=msoControlPopup, _
                      before:=.Controls.Count, _
                      temporary:=True)
                      
    myCtrl.Caption = "IAD"
    
    For iCtr = LBound(myCaps) To UBound(myCaps)
        Set myBTN = myCtrl.Controls.Add(Type:=msoControlButton, _
                        temporary:=True)
        With myBTN
            .OnAction = ThisWorkbook.Name & "!" & myMacs(iCtr)
            .Caption = myCaps(iCtr)
            '.Enabled = OkToShow(iCtr)
            .Visible = OkToShow(iCtr)
            .BeginGroup = myBeginGroup(iCtr)
        End With
    Next iCtr
End With
End Sub
Sub RemoveMenu()
    On Error Resume Next
    Application.CommandBars(1).Controls("IAD").Delete
    On Error GoTo 0
End Sub

Function GetNetworkName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If lngX <> 0 Then
      GetNetworkName = Left$(strUserName, lngLen - 1)
    Else
      GetNetworkName = ""
    End If
End Function

Sub multexformat()
    MsgBox "Multexformat"
End Sub
Sub CreateLabels()
    MsgBox "createlabels"
End Sub
Sub pastevalues()
    MsgBox "pastevalues"
End Sub
Sub HoldingReport()
    MsgBox "holdingReport"
End Sub
Sub aboutaddin()
    MsgBox "aboutaddin"
End Sub

When I have just a few macros that I want to add, I'd use a bunch of arrays. 
But someday, when/if you want to add more, you may want to put lots of these
things in a worksheet and read from there.

John Walkenbach has a very neat workbook that does this.  He calls his
MenuMaker.xls.

You can find it:
http://j-walk.com/ss/excel/tips/tip53.htm




Boycey wrote:
> 
> Windows 2000
> Office XP
> 
> I have created an Excel add-in which creates a new menu item on
> opening, and deletes it in closing.  The menu works fine on my WinXP /
> Office XP machine, and on a number of users' Win2k/Office Xp machines.
> 
> However, on certain computers, the add-in causes Excel to freeze on
> opening.  I have the following code in the "ThisWorkbook" section:
> 
> [START CODE]
> Option Explicit
> 
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> RemoveMenu
> 
> End Sub
> 
> Sub workbook_open()
> NewMenu
> 
> End Sub
> [END CODE]
> 
> which calls procedure "NewMenu" on open.  "NewMenu" contains the
> following code:
> 
> [START CODE]
> Sub NewMenu()
> Dim aMenu As Variant
> Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")
> 
> aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
> aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
> aMenu.MenuItems.Add "-"
> aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
> aMenu.MenuItems.Add "Format Holdings Report",
> OnAction:="HoldingReport"
> 
> aMenu.MenuItems.Add "-"
> 
> aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"
> 
> aMenu.MenuItems("Save rating change").Enabled = False
> aMenu.MenuItems("Format holdings report").Enabled = False
> 
> Select Case GetNetworkName
>     Case "tdonovan", "mnakai"
>        aMenu.MenuItems("Format holdings report").Enabled = True
>     Case "dboyce", "nharris"
>         aMenu.MenuItems("Format holdings report").Enabled = True
>         aMenu.MenuItems("Save rating change").Enabled = True
> End Select
> End Sub
> [END CODE]
> 
> When I open Excel, the IAD menu appears, but Excel freezes, the menus
> do not respond, and no "Book1" new file is created.
> 
> If I remove the NewMenu command from workbook_open, Excel opens as
> normal.  I can the run the workbook_open procedure from VBA with no
> problem at all.
> 
> I cannot find anything wrong with the code - indeed, there can't be,
> as it runs fine when Excel has already been opened.  It is only when
> it is run during the opening of Excel, on the Workbook_open event,
> that problems occur.
> 
> This is a very frustrating problem, not least because the add-in works
> fine on a number of other computers running exactly the same versions
> of Windows and Office.  If anybody has any suggestions, I would be
> very grateful.
> 
> Thanks
> 
> Dom

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
10/29/2004 7:04:10 PM
Hi Dave,

many thanks for your detailed response - I think I will use arrays
from now on to create menu bars!  Unfortunately, the problem still
remains on the Win2k / Office XP computer.

It seems to be something to do with the Workbook_open event in Excel. 
If Excel is started without the add-in, it opens fine.  The add-in can
then be installed, and Excel will work fine, as will the add-in
functions.  However, when Excel is restarted, the program freezes.

I have checked the links you gave me, but the solutions all seem to
stop at finding the add-in causing the problem.  I know this already,
and need to determine why the add-in freezes Excel.

Any more help from anyone would be greatly appreciated.

Dom



Dave Peterson <ec35720@msn.com> wrote in message news:<41829429.8CB81E79@msn.com>...
> I'd guess that it was a coincidence that excel was locking up, too.
> 
> I think I'd do the standard checks first.
> 
> A couple of guesses.
> 
> 1.  Clean up the windows temp folder.  (then test it out)
> 
> 2.  sometimes the file that holds the customized toolbar settings gets hosed.
>     close excel
>     windows start button|Find (or search)
>     search for *.xlb
>     rename them to *.xlbOLD
>     restart excel
>  
>     if it worked, delete the *.xlbOLD files and rebuild any customized toolbars.
> 
>     If it didn't, rename them back to *.xlb.
> 
> Chip Pearson has some notes to help diagnose startup problems at:
> http://www.cpearson.com/excel/StartupErrors.htm
> 
> But in xl97, menus were displaced with commandbars.  Menus were still supported
> for backward compatibility.  Your code worked ok for me in xl2002, but you may
> want to convert it to use commandbars.
> 
> This seemed to match what you wanted--I did put the whole thing in a General
> module, though you could move things back to workbook_open and _beforeopen.
> 
> Option Explicit
> Option Base 0
> Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
>     "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
> Sub auto_close()
>     Call RemoveMenu
> End Sub
> Sub auto_open()
>     Call NewMenu
> End Sub
> Sub NewMenu()
> 
> Dim myCtrl As CommandBarControl
> Dim myBTN As CommandBarButton
> Dim myMacs As Variant
> Dim myCaps As Variant
> Dim iCtr As Variant
> Dim OkToShow() As Boolean
> Dim myBeginGroup() As Boolean
> 
> Call RemoveMenu
> 
> myMacs = Array("multexformat", _
>                "CreateLabels", _
>                "pastevalues", _
>                "HoldingReport", _
>                "AboutAddin")
>                
> myCaps = Array("Format for MIDAS", _
>                "Create labels", _
>                "Save rating change", _
>                "Format Holdings Report", _
>                "About Add-in")
>                
> ReDim OkToShow(LBound(myCaps) To UBound(myCaps))
> OkToShow(0) = True
> OkToShow(1) = True
> OkToShow(2) = False
> OkToShow(3) = False
> OkToShow(4) = True
> 
> ReDim myBeginGroup(LBound(myCaps) To UBound(myCaps))
> myBeginGroup(0) = False
> myBeginGroup(1) = False
> myBeginGroup(2) = True
> myBeginGroup(3) = False
> myBeginGroup(4) = True
> 
> Select Case LCase(GetNetworkName)
>     Case Is = "tdonovan", "mnakai"
>         OkToShow(3) = True
>     Case Is = "dboyce", "nharris"
>         OkToShow(2) = True
>         OkToShow(3) = True
> End Select
>                
> If UBound(myMacs) <> UBound(myCaps) Then
>     MsgBox "Design error--not the same number of elements!"
>     Exit Sub
> End If
> 
> With Application.CommandBars(1)
>     Set myCtrl = .Controls.Add(Type:=msoControlPopup, _
>                       before:=.Controls.Count, _
>                       temporary:=True)
>                       
>     myCtrl.Caption = "IAD"
>     
>     For iCtr = LBound(myCaps) To UBound(myCaps)
>         Set myBTN = myCtrl.Controls.Add(Type:=msoControlButton, _
>                         temporary:=True)
>         With myBTN
>             .OnAction = ThisWorkbook.Name & "!" & myMacs(iCtr)
>             .Caption = myCaps(iCtr)
>             '.Enabled = OkToShow(iCtr)
>             .Visible = OkToShow(iCtr)
>             .BeginGroup = myBeginGroup(iCtr)
>         End With
>     Next iCtr
> End With
> End Sub
> Sub RemoveMenu()
>     On Error Resume Next
>     Application.CommandBars(1).Controls("IAD").Delete
>     On Error GoTo 0
> End Sub
> 
> Function GetNetworkName() As String
> ' Returns the network login name
> Dim lngLen As Long, lngX As Long
> Dim strUserName As String
>     strUserName = String$(254, 0)
>     lngLen = 255
>     lngX = apiGetUserName(strUserName, lngLen)
>     If lngX <> 0 Then
>       GetNetworkName = Left$(strUserName, lngLen - 1)
>     Else
>       GetNetworkName = ""
>     End If
> End Function
> 
> Sub multexformat()
>     MsgBox "Multexformat"
> End Sub
> Sub CreateLabels()
>     MsgBox "createlabels"
> End Sub
> Sub pastevalues()
>     MsgBox "pastevalues"
> End Sub
> Sub HoldingReport()
>     MsgBox "holdingReport"
> End Sub
> Sub aboutaddin()
>     MsgBox "aboutaddin"
> End Sub
> 
> When I have just a few macros that I want to add, I'd use a bunch of arrays. 
> But someday, when/if you want to add more, you may want to put lots of these
> things in a worksheet and read from there.
> 
> John Walkenbach has a very neat workbook that does this.  He calls his
> MenuMaker.xls.
> 
> You can find it:
> http://j-walk.com/ss/excel/tips/tip53.htm
> 
> 
> 
> 
> Boycey wrote:
> > 
> > Windows 2000
> > Office XP
> > 
> > I have created an Excel add-in which creates a new menu item on
> > opening, and deletes it in closing.  The menu works fine on my WinXP /
> > Office XP machine, and on a number of users' Win2k/Office Xp machines.
> > 
> > However, on certain computers, the add-in causes Excel to freeze on
> > opening.  I have the following code in the "ThisWorkbook" section:
> > 
> > [START CODE]
> > Option Explicit
> > 
> > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > RemoveMenu
> > 
> > End Sub
> > 
> > Sub workbook_open()
> > NewMenu
> > 
> > End Sub
> > [END CODE]
> > 
> > which calls procedure "NewMenu" on open.  "NewMenu" contains the
> > following code:
> > 
> > [START CODE]
> > Sub NewMenu()
> > Dim aMenu As Variant
> > Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")
> > 
> > aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
> > aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
> > aMenu.MenuItems.Add "-"
> > aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
> > aMenu.MenuItems.Add "Format Holdings Report",
> > OnAction:="HoldingReport"
> > 
> > aMenu.MenuItems.Add "-"
> > 
> > aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"
> > 
> > aMenu.MenuItems("Save rating change").Enabled = False
> > aMenu.MenuItems("Format holdings report").Enabled = False
> > 
> > Select Case GetNetworkName
> >     Case "tdonovan", "mnakai"
> >        aMenu.MenuItems("Format holdings report").Enabled = True
> >     Case "dboyce", "nharris"
> >         aMenu.MenuItems("Format holdings report").Enabled = True
> >         aMenu.MenuItems("Save rating change").Enabled = True
> > End Select
> > End Sub
> > [END CODE]
> > 
> > When I open Excel, the IAD menu appears, but Excel freezes, the menus
> > do not respond, and no "Book1" new file is created.
> > 
> > If I remove the NewMenu command from workbook_open, Excel opens as
> > normal.  I can the run the workbook_open procedure from VBA with no
> > problem at all.
> > 
> > I cannot find anything wrong with the code - indeed, there can't be,
> > as it runs fine when Excel has already been opened.  It is only when
> > it is run during the opening of Excel, on the Workbook_open event,
> > that problems occur.
> > 
> > This is a very frustrating problem, not least because the add-in works
> > fine on a number of other computers running exactly the same versions
> > of Windows and Office.  If anybody has any suggestions, I would be
> > very grateful.
> > 
> > Thanks
> > 
> > Dom
0
dom_boyce (3)
11/3/2004 2:30:27 PM
I never used those type of menus--so I don't really know if they can cause
problems like you're having (but I would guess not--else there would be lots of
questions about how to convert these to commandbars.)

Did you try converting to commandbars and still have the trouble?

And when inexplicable things happen, this is a common suggestion:

Try running Rob Bovey's code cleaner program.

You can find it at:
http://www.appspro.com/

Boycey wrote:
> 
> Hi Dave,
> 
> many thanks for your detailed response - I think I will use arrays
> from now on to create menu bars!  Unfortunately, the problem still
> remains on the Win2k / Office XP computer.
> 
> It seems to be something to do with the Workbook_open event in Excel.
> If Excel is started without the add-in, it opens fine.  The add-in can
> then be installed, and Excel will work fine, as will the add-in
> functions.  However, when Excel is restarted, the program freezes.
> 
> I have checked the links you gave me, but the solutions all seem to
> stop at finding the add-in causing the problem.  I know this already,
> and need to determine why the add-in freezes Excel.
> 
> Any more help from anyone would be greatly appreciated.
> 
> Dom
> 
> Dave Peterson <ec35720@msn.com> wrote in message news:<41829429.8CB81E79@msn.com>...
> > I'd guess that it was a coincidence that excel was locking up, too.
> >
> > I think I'd do the standard checks first.
> >
> > A couple of guesses.
> >
> > 1.  Clean up the windows temp folder.  (then test it out)
> >
> > 2.  sometimes the file that holds the customized toolbar settings gets hosed.
> >     close excel
> >     windows start button|Find (or search)
> >     search for *.xlb
> >     rename them to *.xlbOLD
> >     restart excel
> >
> >     if it worked, delete the *.xlbOLD files and rebuild any customized toolbars.
> >
> >     If it didn't, rename them back to *.xlb.
> >
> > Chip Pearson has some notes to help diagnose startup problems at:
> > http://www.cpearson.com/excel/StartupErrors.htm
> >
> > But in xl97, menus were displaced with commandbars.  Menus were still supported
> > for backward compatibility.  Your code worked ok for me in xl2002, but you may
> > want to convert it to use commandbars.
> >
> > This seemed to match what you wanted--I did put the whole thing in a General
> > module, though you could move things back to workbook_open and _beforeopen.
> >
> > Option Explicit
> > Option Base 0
> > Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
> >     "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
> > Sub auto_close()
> >     Call RemoveMenu
> > End Sub
> > Sub auto_open()
> >     Call NewMenu
> > End Sub
> > Sub NewMenu()
> >
> > Dim myCtrl As CommandBarControl
> > Dim myBTN As CommandBarButton
> > Dim myMacs As Variant
> > Dim myCaps As Variant
> > Dim iCtr As Variant
> > Dim OkToShow() As Boolean
> > Dim myBeginGroup() As Boolean
> >
> > Call RemoveMenu
> >
> > myMacs = Array("multexformat", _
> >                "CreateLabels", _
> >                "pastevalues", _
> >                "HoldingReport", _
> >                "AboutAddin")
> >
> > myCaps = Array("Format for MIDAS", _
> >                "Create labels", _
> >                "Save rating change", _
> >                "Format Holdings Report", _
> >                "About Add-in")
> >
> > ReDim OkToShow(LBound(myCaps) To UBound(myCaps))
> > OkToShow(0) = True
> > OkToShow(1) = True
> > OkToShow(2) = False
> > OkToShow(3) = False
> > OkToShow(4) = True
> >
> > ReDim myBeginGroup(LBound(myCaps) To UBound(myCaps))
> > myBeginGroup(0) = False
> > myBeginGroup(1) = False
> > myBeginGroup(2) = True
> > myBeginGroup(3) = False
> > myBeginGroup(4) = True
> >
> > Select Case LCase(GetNetworkName)
> >     Case Is = "tdonovan", "mnakai"
> >         OkToShow(3) = True
> >     Case Is = "dboyce", "nharris"
> >         OkToShow(2) = True
> >         OkToShow(3) = True
> > End Select
> >
> > If UBound(myMacs) <> UBound(myCaps) Then
> >     MsgBox "Design error--not the same number of elements!"
> >     Exit Sub
> > End If
> >
> > With Application.CommandBars(1)
> >     Set myCtrl = .Controls.Add(Type:=msoControlPopup, _
> >                       before:=.Controls.Count, _
> >                       temporary:=True)
> >
> >     myCtrl.Caption = "IAD"
> >
> >     For iCtr = LBound(myCaps) To UBound(myCaps)
> >         Set myBTN = myCtrl.Controls.Add(Type:=msoControlButton, _
> >                         temporary:=True)
> >         With myBTN
> >             .OnAction = ThisWorkbook.Name & "!" & myMacs(iCtr)
> >             .Caption = myCaps(iCtr)
> >             '.Enabled = OkToShow(iCtr)
> >             .Visible = OkToShow(iCtr)
> >             .BeginGroup = myBeginGroup(iCtr)
> >         End With
> >     Next iCtr
> > End With
> > End Sub
> > Sub RemoveMenu()
> >     On Error Resume Next
> >     Application.CommandBars(1).Controls("IAD").Delete
> >     On Error GoTo 0
> > End Sub
> >
> > Function GetNetworkName() As String
> > ' Returns the network login name
> > Dim lngLen As Long, lngX As Long
> > Dim strUserName As String
> >     strUserName = String$(254, 0)
> >     lngLen = 255
> >     lngX = apiGetUserName(strUserName, lngLen)
> >     If lngX <> 0 Then
> >       GetNetworkName = Left$(strUserName, lngLen - 1)
> >     Else
> >       GetNetworkName = ""
> >     End If
> > End Function
> >
> > Sub multexformat()
> >     MsgBox "Multexformat"
> > End Sub
> > Sub CreateLabels()
> >     MsgBox "createlabels"
> > End Sub
> > Sub pastevalues()
> >     MsgBox "pastevalues"
> > End Sub
> > Sub HoldingReport()
> >     MsgBox "holdingReport"
> > End Sub
> > Sub aboutaddin()
> >     MsgBox "aboutaddin"
> > End Sub
> >
> > When I have just a few macros that I want to add, I'd use a bunch of arrays.
> > But someday, when/if you want to add more, you may want to put lots of these
> > things in a worksheet and read from there.
> >
> > John Walkenbach has a very neat workbook that does this.  He calls his
> > MenuMaker.xls.
> >
> > You can find it:
> > http://j-walk.com/ss/excel/tips/tip53.htm
> >
> >
> >
> >
> > Boycey wrote:
> > >
> > > Windows 2000
> > > Office XP
> > >
> > > I have created an Excel add-in which creates a new menu item on
> > > opening, and deletes it in closing.  The menu works fine on my WinXP /
> > > Office XP machine, and on a number of users' Win2k/Office Xp machines.
> > >
> > > However, on certain computers, the add-in causes Excel to freeze on
> > > opening.  I have the following code in the "ThisWorkbook" section:
> > >
> > > [START CODE]
> > > Option Explicit
> > >
> > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > RemoveMenu
> > >
> > > End Sub
> > >
> > > Sub workbook_open()
> > > NewMenu
> > >
> > > End Sub
> > > [END CODE]
> > >
> > > which calls procedure "NewMenu" on open.  "NewMenu" contains the
> > > following code:
> > >
> > > [START CODE]
> > > Sub NewMenu()
> > > Dim aMenu As Variant
> > > Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")
> > >
> > > aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
> > > aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
> > > aMenu.MenuItems.Add "-"
> > > aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
> > > aMenu.MenuItems.Add "Format Holdings Report",
> > > OnAction:="HoldingReport"
> > >
> > > aMenu.MenuItems.Add "-"
> > >
> > > aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"
> > >
> > > aMenu.MenuItems("Save rating change").Enabled = False
> > > aMenu.MenuItems("Format holdings report").Enabled = False
> > >
> > > Select Case GetNetworkName
> > >     Case "tdonovan", "mnakai"
> > >        aMenu.MenuItems("Format holdings report").Enabled = True
> > >     Case "dboyce", "nharris"
> > >         aMenu.MenuItems("Format holdings report").Enabled = True
> > >         aMenu.MenuItems("Save rating change").Enabled = True
> > > End Select
> > > End Sub
> > > [END CODE]
> > >
> > > When I open Excel, the IAD menu appears, but Excel freezes, the menus
> > > do not respond, and no "Book1" new file is created.
> > >
> > > If I remove the NewMenu command from workbook_open, Excel opens as
> > > normal.  I can the run the workbook_open procedure from VBA with no
> > > problem at all.
> > >
> > > I cannot find anything wrong with the code - indeed, there can't be,
> > > as it runs fine when Excel has already been opened.  It is only when
> > > it is run during the opening of Excel, on the Workbook_open event,
> > > that problems occur.
> > >
> > > This is a very frustrating problem, not least because the add-in works
> > > fine on a number of other computers running exactly the same versions
> > > of Windows and Office.  If anybody has any suggestions, I would be
> > > very grateful.
> > >
> > > Thanks
> > >
> > > Dom

-- 

Dave Peterson
ec35720@netscape.com
0
ec357208423 (183)
11/4/2004 2:24:25 AM
Dave,

thanks again for your help.  For some inexplicable reason, the add-in
now works fine.  I had even gone to the extent of reinstalling Office,
but to no avail.  Then, yesterday morning, the user started excel and
opened the add-in manually, a necessary workaround while the auto_open
problem was investigated.  When he closed Excel down and restarted,
with the add-in enabled, Excel opened fine, without freezing as it had
done in the past.  Many restarts later, and the problem seems to have
disappeared.

Not the most satisfactory of solutions, as the cause will never be
discovered, but at leas t it works now!

and thanks for the link to the code cleaner - looks very interesting.

Regards

Dom

Dave Peterson <ec35720@netscape.com> wrote in message news:<418992D9.D93F9D27@netscape.com>...
> I never used those type of menus--so I don't really know if they can cause
> problems like you're having (but I would guess not--else there would be lots of
> questions about how to convert these to commandbars.)
> 
> Did you try converting to commandbars and still have the trouble?
> 
> And when inexplicable things happen, this is a common suggestion:
> 
> Try running Rob Bovey's code cleaner program.
> 
> You can find it at:
> http://www.appspro.com/
> 
> Boycey wrote:
> > 
> > Hi Dave,
> > 
> > many thanks for your detailed response - I think I will use arrays
> > from now on to create menu bars!  Unfortunately, the problem still
> > remains on the Win2k / Office XP computer.
> > 
> > It seems to be something to do with the Workbook_open event in Excel.
> > If Excel is started without the add-in, it opens fine.  The add-in can
> > then be installed, and Excel will work fine, as will the add-in
> > functions.  However, when Excel is restarted, the program freezes.
> > 
> > I have checked the links you gave me, but the solutions all seem to
> > stop at finding the add-in causing the problem.  I know this already,
> > and need to determine why the add-in freezes Excel.
> > 
> > Any more help from anyone would be greatly appreciated.
> > 
> > Dom
> > 
> > Dave Peterson <ec35720@msn.com> wrote in message news:<41829429.8CB81E79@msn.com>...
> > > I'd guess that it was a coincidence that excel was locking up, too.
> > >
> > > I think I'd do the standard checks first.
> > >
> > > A couple of guesses.
> > >
> > > 1.  Clean up the windows temp folder.  (then test it out)
> > >
> > > 2.  sometimes the file that holds the customized toolbar settings gets hosed.
> > >     close excel
> > >     windows start button|Find (or search)
> > >     search for *.xlb
> > >     rename them to *.xlbOLD
> > >     restart excel
> > >
> > >     if it worked, delete the *.xlbOLD files and rebuild any customized toolbars.
> > >
> > >     If it didn't, rename them back to *.xlb.
> > >
> > > Chip Pearson has some notes to help diagnose startup problems at:
> > > http://www.cpearson.com/excel/StartupErrors.htm
> > >
> > > But in xl97, menus were displaced with commandbars.  Menus were still supported
> > > for backward compatibility.  Your code worked ok for me in xl2002, but you may
> > > want to convert it to use commandbars.
> > >
> > > This seemed to match what you wanted--I did put the whole thing in a General
> > > module, though you could move things back to workbook_open and _beforeopen.
> > >
> > > Option Explicit
> > > Option Base 0
> > > Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
> > >     "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
> > > Sub auto_close()
> > >     Call RemoveMenu
> > > End Sub
> > > Sub auto_open()
> > >     Call NewMenu
> > > End Sub
> > > Sub NewMenu()
> > >
> > > Dim myCtrl As CommandBarControl
> > > Dim myBTN As CommandBarButton
> > > Dim myMacs As Variant
> > > Dim myCaps As Variant
> > > Dim iCtr As Variant
> > > Dim OkToShow() As Boolean
> > > Dim myBeginGroup() As Boolean
> > >
> > > Call RemoveMenu
> > >
> > > myMacs = Array("multexformat", _
> > >                "CreateLabels", _
> > >                "pastevalues", _
> > >                "HoldingReport", _
> > >                "AboutAddin")
> > >
> > > myCaps = Array("Format for MIDAS", _
> > >                "Create labels", _
> > >                "Save rating change", _
> > >                "Format Holdings Report", _
> > >                "About Add-in")
> > >
> > > ReDim OkToShow(LBound(myCaps) To UBound(myCaps))
> > > OkToShow(0) = True
> > > OkToShow(1) = True
> > > OkToShow(2) = False
> > > OkToShow(3) = False
> > > OkToShow(4) = True
> > >
> > > ReDim myBeginGroup(LBound(myCaps) To UBound(myCaps))
> > > myBeginGroup(0) = False
> > > myBeginGroup(1) = False
> > > myBeginGroup(2) = True
> > > myBeginGroup(3) = False
> > > myBeginGroup(4) = True
> > >
> > > Select Case LCase(GetNetworkName)
> > >     Case Is = "tdonovan", "mnakai"
> > >         OkToShow(3) = True
> > >     Case Is = "dboyce", "nharris"
> > >         OkToShow(2) = True
> > >         OkToShow(3) = True
> > > End Select
> > >
> > > If UBound(myMacs) <> UBound(myCaps) Then
> > >     MsgBox "Design error--not the same number of elements!"
> > >     Exit Sub
> > > End If
> > >
> > > With Application.CommandBars(1)
> > >     Set myCtrl = .Controls.Add(Type:=msoControlPopup, _
> > >                       before:=.Controls.Count, _
> > >                       temporary:=True)
> > >
> > >     myCtrl.Caption = "IAD"
> > >
> > >     For iCtr = LBound(myCaps) To UBound(myCaps)
> > >         Set myBTN = myCtrl.Controls.Add(Type:=msoControlButton, _
> > >                         temporary:=True)
> > >         With myBTN
> > >             .OnAction = ThisWorkbook.Name & "!" & myMacs(iCtr)
> > >             .Caption = myCaps(iCtr)
> > >             '.Enabled = OkToShow(iCtr)
> > >             .Visible = OkToShow(iCtr)
> > >             .BeginGroup = myBeginGroup(iCtr)
> > >         End With
> > >     Next iCtr
> > > End With
> > > End Sub
> > > Sub RemoveMenu()
> > >     On Error Resume Next
> > >     Application.CommandBars(1).Controls("IAD").Delete
> > >     On Error GoTo 0
> > > End Sub
> > >
> > > Function GetNetworkName() As String
> > > ' Returns the network login name
> > > Dim lngLen As Long, lngX As Long
> > > Dim strUserName As String
> > >     strUserName = String$(254, 0)
> > >     lngLen = 255
> > >     lngX = apiGetUserName(strUserName, lngLen)
> > >     If lngX <> 0 Then
> > >       GetNetworkName = Left$(strUserName, lngLen - 1)
> > >     Else
> > >       GetNetworkName = ""
> > >     End If
> > > End Function
> > >
> > > Sub multexformat()
> > >     MsgBox "Multexformat"
> > > End Sub
> > > Sub CreateLabels()
> > >     MsgBox "createlabels"
> > > End Sub
> > > Sub pastevalues()
> > >     MsgBox "pastevalues"
> > > End Sub
> > > Sub HoldingReport()
> > >     MsgBox "holdingReport"
> > > End Sub
> > > Sub aboutaddin()
> > >     MsgBox "aboutaddin"
> > > End Sub
> > >
> > > When I have just a few macros that I want to add, I'd use a bunch of arrays.
> > > But someday, when/if you want to add more, you may want to put lots of these
> > > things in a worksheet and read from there.
> > >
> > > John Walkenbach has a very neat workbook that does this.  He calls his
> > > MenuMaker.xls.
> > >
> > > You can find it:
> > > http://j-walk.com/ss/excel/tips/tip53.htm
> > >
> > >
> > >
> > >
> > > Boycey wrote:
> > > >
> > > > Windows 2000
> > > > Office XP
> > > >
> > > > I have created an Excel add-in which creates a new menu item on
> > > > opening, and deletes it in closing.  The menu works fine on my WinXP /
> > > > Office XP machine, and on a number of users' Win2k/Office Xp machines.
> > > >
> > > > However, on certain computers, the add-in causes Excel to freeze on
> > > > opening.  I have the following code in the "ThisWorkbook" section:
> > > >
> > > > [START CODE]
> > > > Option Explicit
> > > >
> > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > RemoveMenu
> > > >
> > > > End Sub
> > > >
> > > > Sub workbook_open()
> > > > NewMenu
> > > >
> > > > End Sub
> > > > [END CODE]
> > > >
> > > > which calls procedure "NewMenu" on open.  "NewMenu" contains the
> > > > following code:
> > > >
> > > > [START CODE]
> > > > Sub NewMenu()
> > > > Dim aMenu As Variant
> > > > Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")
> > > >
> > > > aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
> > > > aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
> > > > aMenu.MenuItems.Add "-"
> > > > aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
> > > > aMenu.MenuItems.Add "Format Holdings Report",
> > > > OnAction:="HoldingReport"
> > > >
> > > > aMenu.MenuItems.Add "-"
> > > >
> > > > aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"
> > > >
> > > > aMenu.MenuItems("Save rating change").Enabled = False
> > > > aMenu.MenuItems("Format holdings report").Enabled = False
> > > >
> > > > Select Case GetNetworkName
> > > >     Case "tdonovan", "mnakai"
> > > >        aMenu.MenuItems("Format holdings report").Enabled = True
> > > >     Case "dboyce", "nharris"
> > > >         aMenu.MenuItems("Format holdings report").Enabled = True
> > > >         aMenu.MenuItems("Save rating change").Enabled = True
> > > > End Select
> > > > End Sub
> > > > [END CODE]
> > > >
> > > > When I open Excel, the IAD menu appears, but Excel freezes, the menus
> > > > do not respond, and no "Book1" new file is created.
> > > >
> > > > If I remove the NewMenu command from workbook_open, Excel opens as
> > > > normal.  I can the run the workbook_open procedure from VBA with no
> > > > problem at all.
> > > >
> > > > I cannot find anything wrong with the code - indeed, there can't be,
> > > > as it runs fine when Excel has already been opened.  It is only when
> > > > it is run during the opening of Excel, on the Workbook_open event,
> > > > that problems occur.
> > > >
> > > > This is a very frustrating problem, not least because the add-in works
> > > > fine on a number of other computers running exactly the same versions
> > > > of Windows and Office.  If anybody has any suggestions, I would be
> > > > very grateful.
> > > >
> > > > Thanks
> > > >
> > > > Dom
0
dom_boyce (3)
11/5/2004 11:16:26 AM
Call it a victory and run for your life when that user shows up again!

Boycey wrote:
> 
> Dave,
> 
> thanks again for your help.  For some inexplicable reason, the add-in
> now works fine.  I had even gone to the extent of reinstalling Office,
> but to no avail.  Then, yesterday morning, the user started excel and
> opened the add-in manually, a necessary workaround while the auto_open
> problem was investigated.  When he closed Excel down and restarted,
> with the add-in enabled, Excel opened fine, without freezing as it had
> done in the past.  Many restarts later, and the problem seems to have
> disappeared.
> 
> Not the most satisfactory of solutions, as the cause will never be
> discovered, but at leas t it works now!
> 
> and thanks for the link to the code cleaner - looks very interesting.
> 
> Regards
> 
> Dom
> 
> Dave Peterson <ec35720@netscape.com> wrote in message news:<418992D9.D93F9D27@netscape.com>...
> > I never used those type of menus--so I don't really know if they can cause
> > problems like you're having (but I would guess not--else there would be lots of
> > questions about how to convert these to commandbars.)
> >
> > Did you try converting to commandbars and still have the trouble?
> >
> > And when inexplicable things happen, this is a common suggestion:
> >
> > Try running Rob Bovey's code cleaner program.
> >
> > You can find it at:
> > http://www.appspro.com/
> >
> > Boycey wrote:
> > >
> > > Hi Dave,
> > >
> > > many thanks for your detailed response - I think I will use arrays
> > > from now on to create menu bars!  Unfortunately, the problem still
> > > remains on the Win2k / Office XP computer.
> > >
> > > It seems to be something to do with the Workbook_open event in Excel.
> > > If Excel is started without the add-in, it opens fine.  The add-in can
> > > then be installed, and Excel will work fine, as will the add-in
> > > functions.  However, when Excel is restarted, the program freezes.
> > >
> > > I have checked the links you gave me, but the solutions all seem to
> > > stop at finding the add-in causing the problem.  I know this already,
> > > and need to determine why the add-in freezes Excel.
> > >
> > > Any more help from anyone would be greatly appreciated.
> > >
> > > Dom
> > >
> > > Dave Peterson <ec35720@msn.com> wrote in message news:<41829429.8CB81E79@msn.com>...
> > > > I'd guess that it was a coincidence that excel was locking up, too.
> > > >
> > > > I think I'd do the standard checks first.
> > > >
> > > > A couple of guesses.
> > > >
> > > > 1.  Clean up the windows temp folder.  (then test it out)
> > > >
> > > > 2.  sometimes the file that holds the customized toolbar settings gets hosed.
> > > >     close excel
> > > >     windows start button|Find (or search)
> > > >     search for *.xlb
> > > >     rename them to *.xlbOLD
> > > >     restart excel
> > > >
> > > >     if it worked, delete the *.xlbOLD files and rebuild any customized toolbars.
> > > >
> > > >     If it didn't, rename them back to *.xlb.
> > > >
> > > > Chip Pearson has some notes to help diagnose startup problems at:
> > > > http://www.cpearson.com/excel/StartupErrors.htm
> > > >
> > > > But in xl97, menus were displaced with commandbars.  Menus were still supported
> > > > for backward compatibility.  Your code worked ok for me in xl2002, but you may
> > > > want to convert it to use commandbars.
> > > >
> > > > This seemed to match what you wanted--I did put the whole thing in a General
> > > > module, though you could move things back to workbook_open and _beforeopen.
> > > >
> > > > Option Explicit
> > > > Option Base 0
> > > > Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
> > > >     "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
> > > > Sub auto_close()
> > > >     Call RemoveMenu
> > > > End Sub
> > > > Sub auto_open()
> > > >     Call NewMenu
> > > > End Sub
> > > > Sub NewMenu()
> > > >
> > > > Dim myCtrl As CommandBarControl
> > > > Dim myBTN As CommandBarButton
> > > > Dim myMacs As Variant
> > > > Dim myCaps As Variant
> > > > Dim iCtr As Variant
> > > > Dim OkToShow() As Boolean
> > > > Dim myBeginGroup() As Boolean
> > > >
> > > > Call RemoveMenu
> > > >
> > > > myMacs = Array("multexformat", _
> > > >                "CreateLabels", _
> > > >                "pastevalues", _
> > > >                "HoldingReport", _
> > > >                "AboutAddin")
> > > >
> > > > myCaps = Array("Format for MIDAS", _
> > > >                "Create labels", _
> > > >                "Save rating change", _
> > > >                "Format Holdings Report", _
> > > >                "About Add-in")
> > > >
> > > > ReDim OkToShow(LBound(myCaps) To UBound(myCaps))
> > > > OkToShow(0) = True
> > > > OkToShow(1) = True
> > > > OkToShow(2) = False
> > > > OkToShow(3) = False
> > > > OkToShow(4) = True
> > > >
> > > > ReDim myBeginGroup(LBound(myCaps) To UBound(myCaps))
> > > > myBeginGroup(0) = False
> > > > myBeginGroup(1) = False
> > > > myBeginGroup(2) = True
> > > > myBeginGroup(3) = False
> > > > myBeginGroup(4) = True
> > > >
> > > > Select Case LCase(GetNetworkName)
> > > >     Case Is = "tdonovan", "mnakai"
> > > >         OkToShow(3) = True
> > > >     Case Is = "dboyce", "nharris"
> > > >         OkToShow(2) = True
> > > >         OkToShow(3) = True
> > > > End Select
> > > >
> > > > If UBound(myMacs) <> UBound(myCaps) Then
> > > >     MsgBox "Design error--not the same number of elements!"
> > > >     Exit Sub
> > > > End If
> > > >
> > > > With Application.CommandBars(1)
> > > >     Set myCtrl = .Controls.Add(Type:=msoControlPopup, _
> > > >                       before:=.Controls.Count, _
> > > >                       temporary:=True)
> > > >
> > > >     myCtrl.Caption = "IAD"
> > > >
> > > >     For iCtr = LBound(myCaps) To UBound(myCaps)
> > > >         Set myBTN = myCtrl.Controls.Add(Type:=msoControlButton, _
> > > >                         temporary:=True)
> > > >         With myBTN
> > > >             .OnAction = ThisWorkbook.Name & "!" & myMacs(iCtr)
> > > >             .Caption = myCaps(iCtr)
> > > >             '.Enabled = OkToShow(iCtr)
> > > >             .Visible = OkToShow(iCtr)
> > > >             .BeginGroup = myBeginGroup(iCtr)
> > > >         End With
> > > >     Next iCtr
> > > > End With
> > > > End Sub
> > > > Sub RemoveMenu()
> > > >     On Error Resume Next
> > > >     Application.CommandBars(1).Controls("IAD").Delete
> > > >     On Error GoTo 0
> > > > End Sub
> > > >
> > > > Function GetNetworkName() As String
> > > > ' Returns the network login name
> > > > Dim lngLen As Long, lngX As Long
> > > > Dim strUserName As String
> > > >     strUserName = String$(254, 0)
> > > >     lngLen = 255
> > > >     lngX = apiGetUserName(strUserName, lngLen)
> > > >     If lngX <> 0 Then
> > > >       GetNetworkName = Left$(strUserName, lngLen - 1)
> > > >     Else
> > > >       GetNetworkName = ""
> > > >     End If
> > > > End Function
> > > >
> > > > Sub multexformat()
> > > >     MsgBox "Multexformat"
> > > > End Sub
> > > > Sub CreateLabels()
> > > >     MsgBox "createlabels"
> > > > End Sub
> > > > Sub pastevalues()
> > > >     MsgBox "pastevalues"
> > > > End Sub
> > > > Sub HoldingReport()
> > > >     MsgBox "holdingReport"
> > > > End Sub
> > > > Sub aboutaddin()
> > > >     MsgBox "aboutaddin"
> > > > End Sub
> > > >
> > > > When I have just a few macros that I want to add, I'd use a bunch of arrays.
> > > > But someday, when/if you want to add more, you may want to put lots of these
> > > > things in a worksheet and read from there.
> > > >
> > > > John Walkenbach has a very neat workbook that does this.  He calls his
> > > > MenuMaker.xls.
> > > >
> > > > You can find it:
> > > > http://j-walk.com/ss/excel/tips/tip53.htm
> > > >
> > > >
> > > >
> > > >
> > > > Boycey wrote:
> > > > >
> > > > > Windows 2000
> > > > > Office XP
> > > > >
> > > > > I have created an Excel add-in which creates a new menu item on
> > > > > opening, and deletes it in closing.  The menu works fine on my WinXP /
> > > > > Office XP machine, and on a number of users' Win2k/Office Xp machines.
> > > > >
> > > > > However, on certain computers, the add-in causes Excel to freeze on
> > > > > opening.  I have the following code in the "ThisWorkbook" section:
> > > > >
> > > > > [START CODE]
> > > > > Option Explicit
> > > > >
> > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > > RemoveMenu
> > > > >
> > > > > End Sub
> > > > >
> > > > > Sub workbook_open()
> > > > > NewMenu
> > > > >
> > > > > End Sub
> > > > > [END CODE]
> > > > >
> > > > > which calls procedure "NewMenu" on open.  "NewMenu" contains the
> > > > > following code:
> > > > >
> > > > > [START CODE]
> > > > > Sub NewMenu()
> > > > > Dim aMenu As Variant
> > > > > Set aMenu = MenuBars(xlWorksheet).Menus.Add("IAD")
> > > > >
> > > > > aMenu.MenuItems.Add "Format for MIDAS", OnAction:="multexformat"
> > > > > aMenu.MenuItems.Add "Create labels", OnAction:="CreateLabels"
> > > > > aMenu.MenuItems.Add "-"
> > > > > aMenu.MenuItems.Add "Save rating change", OnAction:="pastevalues"
> > > > > aMenu.MenuItems.Add "Format Holdings Report",
> > > > > OnAction:="HoldingReport"
> > > > >
> > > > > aMenu.MenuItems.Add "-"
> > > > >
> > > > > aMenu.MenuItems.Add "About Add-in", OnAction:="AboutAddin"
> > > > >
> > > > > aMenu.MenuItems("Save rating change").Enabled = False
> > > > > aMenu.MenuItems("Format holdings report").Enabled = False
> > > > >
> > > > > Select Case GetNetworkName
> > > > >     Case "tdonovan", "mnakai"
> > > > >        aMenu.MenuItems("Format holdings report").Enabled = True
> > > > >     Case "dboyce", "nharris"
> > > > >         aMenu.MenuItems("Format holdings report").Enabled = True
> > > > >         aMenu.MenuItems("Save rating change").Enabled = True
> > > > > End Select
> > > > > End Sub
> > > > > [END CODE]
> > > > >
> > > > > When I open Excel, the IAD menu appears, but Excel freezes, the menus
> > > > > do not respond, and no "Book1" new file is created.
> > > > >
> > > > > If I remove the NewMenu command from workbook_open, Excel opens as
> > > > > normal.  I can the run the workbook_open procedure from VBA with no
> > > > > problem at all.
> > > > >
> > > > > I cannot find anything wrong with the code - indeed, there can't be,
> > > > > as it runs fine when Excel has already been opened.  It is only when
> > > > > it is run during the opening of Excel, on the Workbook_open event,
> > > > > that problems occur.
> > > > >
> > > > > This is a very frustrating problem, not least because the add-in works
> > > > > fine on a number of other computers running exactly the same versions
> > > > > of Windows and Office.  If anybody has any suggestions, I would be
> > > > > very grateful.
> > > > >
> > > > > Thanks
> > > > >
> > > > > Dom

-- 

Dave Peterson
ec35720@netscape.com
0
ec357208423 (183)
11/5/2004 8:51:26 PM
Reply:

Similar Artilces:

How to use outlook address in Excel
Hello, I have an Excel sheet which I use as an invoicing-application. I would like to retrieve address-data from Outlook where I keep all my contact-data of my customers. So, I want to select a customer from my Outlook contactlist when I am writing a new invoice in Excel. In Word, I have a macro which does this, but unfortunately the Application.GetAddress does not work in Excel. Can somebody help me ? "Henny Slokker" wrote: > Hello, > > I have an Excel sheet which I use as an invoicing-application. I would like > to retrieve address-data from Outlook where I...

Pasting data from Excel
Hello everyone, I'm not sure if I should be posting this question here or in the Excel forum but here goes. Is it possible to copy data from multiple cells in Excel and then paste them into multiple lines of the criteria section of an Access query? For example, Given cells and values: A1- 1 A2- 2 A3- 3 I would like to be able to copy this data from Excel and paste it into an Access query like : Criteria: 1 or: 2 3 I am using Access 2002 SP3 and Exc...

Excel Drop Down Box
I'm trying to edit an excel worksheet that has drop down boxes. However, the drop down boxes are not typical forms. These drop dow boxes appear to be normal cells (They contain text). When I click o the box, a little gray box shows up w/ a down arrow to the right of th cell. However, if you right click on the cell, there aren't an property options that are displayed. I was wondering if anybody had any idea what kind of drop down box thi is. How can I edit or create one -- Message posted from http://www.ExcelForum.com It sounds like it's under Data|Validation. chris313 wr...

how to select multiple text boxes in excel for formatting
I am trying to select multiple text boxes for formatting the font but seem unable to select all of them other than to click on each one individually. Is there an easy way to select all of the text boxes at once? To select multiple objects on the sheet -- Click on one object Hold the Ctrl key, and click on additional objects To select all the objects on the sheet -- Choose Edit>Go To, click Special Select Objects, click OK Or, to work with specific objects, you can add the 'Select Multiple Objects' tool to one of your toolbars: Choose Tools>Customize Select the Commands tab...

how to freeze pane with only one row?
Hello all, I am trying to create a view so that I can see my header row as I scroll down a table with thousands of records/rows. When I select this row1 and then go to Window->Freeze Panes, I get a pane that contains the first 12 rows. I would like just the 1st row to be frozen in this pane. Have tried selecting the entire row and just the columns in the first row that are required - to no avail. Can anyone help me do this? Thanks! symp news, select a cell in row 2 then freeze panes -- Paul B Always backup your data before trying something new Please post any response to the newsgroups...

excel margin issues on landscape
When I print a spreadsheet I cant get it to print to the full page - it prints smaller unlike older excel program. Also when i set the margins for a spreadsheet the left hand margin wont move over to the edge of page like right hand side? In Page Setup: If you are using the Scaling option to print to a certain number of pages wide by pages tall and/or you are using the columns to repeat at left, try: - clearing the number of pages tall value (so that it is blank), and/or - if you are printing to one page wide, remove the columns to repeat at left Simon "Peter MB" wrote: >...

Excel macro list
In Excel 2003 I used to be able to list all macros in a workbook by pressing Alt+F8. Now all I get is a series of ribbon help letters... What's changed? Is there still a way of accessing macros via Alt+F8? Any suggestions appreciated. Hi, ALT+F8 works for me in E2007. What do you mean by 'I get is a series of ribbon help letters' Mike "pbaker6" wrote: > In Excel 2003 I used to be able to list all macros in a workbook by pressing > Alt+F8. Now all I get is a series of ribbon help letters... What's changed? > Is there still a way of...

Can I only allow printing to pdf in Excel?
I have created a template in Excel which has been set up so that the layout is perfect when printing to pdf (which is how the document will mostly be used) but the layout changes if printing direct to our printer. Is there a way that I can ONLY allow printing to pdf from this document? Hello You may consider using some VBA to achieve this. One way is to use the Workbook_BeforePrint event and specify the pdf printer in the PrintOut method, eg: Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PrintOut copies:=1, ActivePrinter:="CutePDF Writer on CPW2:" End Sub Pl...

query will not write to excel
I have set up a query to a Foxpro .dbf file in a database from excel. When I tell Excel to import the data it it appears to be working but never seems to return the data. Running the same query via msquery.exe returns the data with no problem. Can anyone tell me what the problem is ? ...

EXCEL FORMULA #28
Good afternoon, I'm trying to fine a formula which would show me how much money I would save on a mortgage if I were to pay additional principal each month--in addition to paying the additional principal how long would it take to pay off. I'm looking at a 160k mortgage at 7.5 for 30 years. I'll like to pay this off as soon as possible by paying additional principal each month. There are tons of free templates at: http://office.microsoft.com/en-us/default.aspx Maybe you'll find something you like. Kam1999i wrote: > > Good afternoon, > > I'm ...

OLE: Excel.Application
Hello, in VB.Net, I use Excel to display results : dim xl as new Excel.Application // creates an Excel process // snip (putting values into cells) xl.Visible = true If the user closes the Excel file and then my program, the Excel process is killed in memory, which is good. If the user closes my program first and then the Excel file, the Excel process remains in memory ! How can I make sure the process will be killed ? Thanks ! Hi You need to set xl.quit (and before that ensure that excel doesn't halt and ask things like "save changes?" on quitting) somewhere in your p...

Export relationship information from Visio to Excel
Hello all, Is there a way to export information regarding relationships from a visio diagram to an excel spreadsheet? In addition, is there a way to tell the excel spreadsheet to eliminate or change a relationship and for that action to be applied onto the visio diagram? thanks, ivan as a general answer I'd have to say "no, not without custom code". You didn't define what you meant as a relationship. al "Ivan Salas" <IvanSalas@discussions.microsoft.com> wrote in message news:6332A594-E4AF-4E8B-BA2D-7A4BC17962B3@microsoft.com... > Hello all, > &...

startup excel euro symbol
when i digit € symbol inside any application excel 2007 automacic startup and for me is impossible to use this symbol anywhere, i use windows xp professional ..have you a response to solve this problem? thanks ...

Excel 2003 Print Issue
I have created a spreadsheet to help with a university engineering assignment and I have added a worksheet that is basically an automatically generated report of all the calculations. I have set the Print Area up in such a way so that the results are printed out in well defined pages (e.g. page 1: title page, page 2: summary of input variables, page 3: summary of calculation results etc). The report is arranged vertically in the worksheet, so the pages are 'stacked' on top of each other. It prints out fine in Excel 2000 and 2002 but I recently upgraded to Excel 2003 and now find tha...

excel 2000 message
excel 2000 message - 'cannot use object linking and embedding' Were they hit by the MSBlast worm? One poster (Lutz Meyer) guessed that this was the cause of his problems. I haven't seen any confirmation/denial, but you may want to read his post: http://groups.google.com/groups?threadm=3F3971AF.FA4490F5%40msn.com Post back with your results. I'm curious if that was the problem. (It's come up quite a few times since MSBlast hit.) bill bootle wrote: > > excel 2000 message - 'cannot use object linking and > embedding' -- Dave Peterson ec35720@msn.c...

Excel Graphing Line References off when chart is a sheet.
I have noticed that when any graph is created in EXCEL and you hover you mouse over the dataline you receive that corect response. If you convert the chart to a sheet, the hover of the data line is now not representative of the the y axis directly below it. The data being graphed is correct now the hover represents the "series" (x-Axis) correctly but does not represent the "Point" (y-axis) correctly at all. Tne Y-axis datapoint reference is wrong. Any help? ...

Editable Excel Spreadsheet Online?
Hi, I tried to recent find information on this, but could find very little. How difficult would it be to host an excel spreadsheet online where visitors to the site can directly view and edit it? Right now, I can upload the spreadsheet to our web site and visitors can view it, but if they edit it, they can only save it to their local drive. I would like the users to be able to save the copy on the server. What would be involved in something like this? I assume for starters (if it's do-able) we'd need Windows hosting (we're not hosting ourselves) and some ASP support. Any de...

how do I delete documents from the start list in word and excel?
how do I delete documents from the start list in word and excel? You can not clear it whenever you want. You can however set the no of file names to be displayed to 0 which clears the list... In Excel 2003 Tool->Options->General Enter 0 against 'Recently Used File List' of clear the check box. Click 'OK' Word has a similar option. For 2007 versions or if you want to play with Registry Settings (not advised unless you understand it well) see http://www.mydigitallife.info/2008/01/13/how-to-clear-and-delete-recent-documents-list-in-office-2007-word-excel-p...

Error saving Excel files in a network drive
I have a problem saving Excel files onto a network drive. I get an error saying it was imposible to save the file. It creates a temporary file and then I have to open it and save it as a new document. This issue doesn�t occur saving the file in my hard disk. This happens with "Full control" access to the shared folder... I have Windows XP and Office 2000. Thanks in advance Mateo. Hi Mateo, > I have a problem saving Excel files onto a network drive. I get an error > saying it was imposible to save the file. It creates a temporary file and > then I have to open it and sav...

Import contacts from Excel into Outlook Contacts
I know this can be done from the import function in Outlook but how does one control where each field goes? There's a Map Fields step in the wizard. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Maurice" <anonymous@discussions.microsoft.com> wrote in message news:5e0a01c48154$f16ff9e0$a401280a@phx.gbl... > I know this can be done from the import function in > Outlook but how does one control where each field goes? ...

How do I print grayscale font in Excel 2003?
In print preview, and on printed pages, all colored font shows up as black. White font stays white. Font colors are displayed correctly in the worksheet. I have already tried the following: -> uncheck "black and white" in page setup -> change printer resolution, etc. -> creating a new workbook, typing some sample text and changing the color: the problem is not confined to one workbook. -> gray cell shading prints as gray: the problem is confined to fonts. -> colored font in Word previews and prints as displayed: the problem is confined to Excel. -> Excel help ...

Excel 2007 text flash (or blink)
This might have been asked before but if so I'm not finding it when I use a google groups search, mainly because of either none or too many answers returned depending on which keywords I use. Is it possible to make the text and/or the background in any individual cells to flash or blink ? In detail what I need to do is have a cell with a solid black background, text which is yellow, but blinking at a slow cadence, 1 sec on 1 sec off in such a way that it looks as if the text in the cell is flashing between off and on like a flashing light. -- Nick hi also have a look...

how can i start using excel for the first time?
i cant figure out how to get excel to work for me and im a first time user of it? i Cant get nothing to work on it? can anyone please help me here Paul Can you get Excel to start up? Can you get a blank workbook to open via File>New? For basics on Excel see.......... http://www.usd.edu/trio/tut/excel/index.html http://www.baycongroup.com/el0.htm Microsoft Training Courses. http://office.microsoft.com/en-us/training/CR061831141033.aspx Gord Dibben Excel MVP On Wed, 15 Dec 2004 15:39:02 -0800, "Paul Scheffer" <Paul Scheffer@discussions.microsoft.com> wrote: >i ...

How do I hyperlink from Excel to a document held in Lotus Notes?
I'm a relatively new user of Excel. We have documents held in both MS-Word and on a Lotus Notes database. I'm wanting to hyperlink from Excel to a document held within a Lotus Notes database. Two questions, firstly, is this possible, secondly, how do you do it. Thanks a lot. ...

Why Excel is accessing Internet & Slowing Excel Performance
Whenever I have my wireless connection on, every action I perform in Excel is extremely slow and I notice my wireless icon in the tray is activated. It looks like it sending data. The Excel Data is locate on my hard drive, so it should not be looking for anything over the wireless. When I shut down the wireless, the performace of Excel return. Could it be that excel is trying to get to the online help? Tools|options|General Tab|Service Options button Online Content category (modify as you like) -- You can get there through the Help|Customer Feedback Options, too. I should have aske...