Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
akm akm is offline
external usenet poster
 
Posts: 19
Default Run-time error '5': Invalid procdre call or argumnt - End/Debug/He

When exit Excel, get 'Microsoft Visual Basic' pop-up error message ...
"Run-time error '5': Invalid procedure call or argument", with buttons 'End',
'Debug', and 'Help' to click.

When click 'End', the program ends and all seems ok.

Why does it need to go thru this process, and is there a problem that we are
missing ?

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Run-time error '5': Invalid procdre call or argumnt - End/Debug/He

the is a macro whih gets executed automatically when you close the workbook.
If you press debug you will see the macro. You can copy and post the code if
you want help getting rid of the error.

Yo can also delete the macro if you want.

"akm" wrote:

When exit Excel, get 'Microsoft Visual Basic' pop-up error message ...
"Run-time error '5': Invalid procedure call or argument", with buttons 'End',
'Debug', and 'Help' to click.

When click 'End', the program ends and all seems ok.

Why does it need to go thru this process, and is there a problem that we are
missing ?

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)

  #3   Report Post  
Posted to microsoft.public.excel.misc
akm akm is offline
external usenet poster
 
Posts: 19
Default Run-time error '5': Invalid procdre call or argumnt - End/Debu

Joel
Thank you for the reply!
The code is as follows...

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)

' remove item from menu
Application.CommandBars("Worksheet Menu
Bar").Controls("&Tools").Controls("Custom Delimited File") _
.Delete

End Sub

Private Sub Workbook_Open()

Dim cb As CommandBar
Dim cbp As CommandBarPopup
Dim cbb As CommandBarButton

' add button under Tools to the Excel menu to execute the add-in

Set cb = Application.CommandBars("Worksheet Menu Bar")
Set cbp = cb.Controls("&Tools")
Set cbb = cbp.Controls.Add(Type:=msoControlButton, Temporary:=True)
With cbb
.Caption = "Custom Delimited File"
.BeginGroup = True
.OnAction = "MakeFile"
On Error Resume Next
.FaceId = 3272
On Error GoTo 0
End With

Set cbp = Nothing
Set cbb = Nothing
Set cb = Nothing

End Sub

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)



"Joel" wrote:

the is a macro whih gets executed automatically when you close the workbook.
If you press debug you will see the macro. You can copy and post the code if
you want help getting rid of the error.

Yo can also delete the macro if you want.

"akm" wrote:

When exit Excel, get 'Microsoft Visual Basic' pop-up error message ...
"Run-time error '5': Invalid procedure call or argument", with buttons 'End',
'Debug', and 'Help' to click.

When click 'End', the program ends and all seems ok.

Why does it need to go thru this process, and is there a problem that we are
missing ?

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Run-time error '5': Invalid procdre call or argumnt - End/Debu

--To handle the error add one more line in Private Sub Workbook_BeforeClose
as below...

--Mean while is there a additional button getting added under the Tools menu
named 'Custom Delimited File'


Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next

' remove item from menu
Application.CommandBars("Worksheet Menu
Bar").Controls("&Tools").Controls("Custom Delimited File") _
.Delete
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"akm" wrote:

Joel
Thank you for the reply!
The code is as follows...

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)

' remove item from menu
Application.CommandBars("Worksheet Menu
Bar").Controls("&Tools").Controls("Custom Delimited File") _
.Delete

End Sub

Private Sub Workbook_Open()

Dim cb As CommandBar
Dim cbp As CommandBarPopup
Dim cbb As CommandBarButton

' add button under Tools to the Excel menu to execute the add-in

Set cb = Application.CommandBars("Worksheet Menu Bar")
Set cbp = cb.Controls("&Tools")
Set cbb = cbp.Controls.Add(Type:=msoControlButton, Temporary:=True)
With cbb
.Caption = "Custom Delimited File"
.BeginGroup = True
.OnAction = "MakeFile"
On Error Resume Next
.FaceId = 3272
On Error GoTo 0
End With

Set cbp = Nothing
Set cbb = Nothing
Set cb = Nothing

End Sub

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)



"Joel" wrote:

the is a macro whih gets executed automatically when you close the workbook.
If you press debug you will see the macro. You can copy and post the code if
you want help getting rid of the error.

Yo can also delete the macro if you want.

"akm" wrote:

When exit Excel, get 'Microsoft Visual Basic' pop-up error message ...
"Run-time error '5': Invalid procedure call or argument", with buttons 'End',
'Debug', and 'Help' to click.

When click 'End', the program ends and all seems ok.

Why does it need to go thru this process, and is there a problem that we are
missing ?

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Run-time error '5': Invalid procdre call or argumnt - End/Debu

What version of excel are you using? Do you specify allow macros to run
whenyou open the workbook?

The macro you psoted is deleting a toolbar when the workbook is closed. The
toolbar was added by the workbook opn event that you posted. the workbook
open event has an On Error statement that is probably eliminating the error
when the workbook is opened. If you are not using the command bar then I
would eliminate all the code and save the workbook. It is silly to have code
in a spreadsheet that you never use.

"Jacob Skaria" wrote:

--To handle the error add one more line in Private Sub Workbook_BeforeClose
as below...

--Mean while is there a additional button getting added under the Tools menu
named 'Custom Delimited File'


Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next

' remove item from menu
Application.CommandBars("Worksheet Menu
Bar").Controls("&Tools").Controls("Custom Delimited File") _
.Delete
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"akm" wrote:

Joel
Thank you for the reply!
The code is as follows...

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)

' remove item from menu
Application.CommandBars("Worksheet Menu
Bar").Controls("&Tools").Controls("Custom Delimited File") _
.Delete

End Sub

Private Sub Workbook_Open()

Dim cb As CommandBar
Dim cbp As CommandBarPopup
Dim cbb As CommandBarButton

' add button under Tools to the Excel menu to execute the add-in

Set cb = Application.CommandBars("Worksheet Menu Bar")
Set cbp = cb.Controls("&Tools")
Set cbb = cbp.Controls.Add(Type:=msoControlButton, Temporary:=True)
With cbb
.Caption = "Custom Delimited File"
.BeginGroup = True
.OnAction = "MakeFile"
On Error Resume Next
.FaceId = 3272
On Error GoTo 0
End With

Set cbp = Nothing
Set cbb = Nothing
Set cb = Nothing

End Sub

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)



"Joel" wrote:

the is a macro whih gets executed automatically when you close the workbook.
If you press debug you will see the macro. You can copy and post the code if
you want help getting rid of the error.

Yo can also delete the macro if you want.

"akm" wrote:

When exit Excel, get 'Microsoft Visual Basic' pop-up error message ...
"Run-time error '5': Invalid procedure call or argument", with buttons 'End',
'Debug', and 'Help' to click.

When click 'End', the program ends and all seems ok.

Why does it need to go thru this process, and is there a problem that we are
missing ?

--
Thanks again for your help.
OS: XP, SP-2 (Office2003)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug Error Ed Davis Excel Discussion (Misc queries) 7 June 16th 09 03:10 PM
Debug Error Ed Davis Excel Discussion (Misc queries) 0 June 16th 09 09:59 AM
Debug Error Saxman Excel Discussion (Misc queries) 3 August 11th 08 12:42 PM
Run-time Error '5' - Invalid procedure call or argument Trefor Excel Discussion (Misc queries) 2 December 17th 07 03:32 AM
Run-time error '5': Invalid Procedure Call or Argument Nikila Excel Discussion (Misc queries) 2 February 24th 06 09:26 PM


All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"