PDA

View Full Version : Run-Time Error '5': Invalid procedure call or argument



akreidler
03-22-2013, 10:18 AM
Hello,

I am recieving a "Run-Time error '5': Invalid procedure call or argument" when I try to select my worksheet tab called "Data Input". When I debug the macro, it debugs it to this line:

Option Explicit
Private Sub Worksheet_Activate()
Application.CommandBars(sToolBarDataInputActions).Visible = True
End Sub

Would you know why I am getting this? This worksheet is on Excel 2010. Thanks so much

akreidler
03-22-2013, 10:27 AM
The script above is inserted inside the sheet, while this is locatedd in ThisWorkbook

Option Explicit
Private Sub Workbook_Open()
'Check to see if to toolbars exist, if they do display the appropriate one for the sheet
Dim sCommandBar As CommandBar
Dim iCommandBarCount As Integer
For Each sCommandBar In Application.CommandBars
If (sCommandBar.Name = sToolBarTemplateActions) Or (sCommandBar.Name = sToolBarDataInputActions) Or _
(sCommandBar.Name = sToolBarStagingAndSubmissionActions) Then
iCommandBarCount = iCommandBarCount + 1
Call recreateToolBar(sCommandBar.Name)
End If
Next sCommandBar

'If the commandbars don't exist then create them
If iCommandBarCount = 0 Then
Call createToolBar(sToolBarTemplateActions)
Call createToolBar(sToolBarDataInputActions)
Call createToolBar(sToolBarStagingAndSubmissionActions)
End If

'Activate the appropriate toolbar
Select Case ActiveSheet.Name
Case sSheet3
Application.CommandBars(sToolBarTemplateActions).Visible = True
Case sSheet4
Application.CommandBars(sToolBarDataInputActions).Visible = True
Case sSheet5
Application.CommandBars(sToolBarStagingAndSubmissionActions).Visible = True
End Select
'Initialize btnProtocol
Sheets(sSheet2).btnProtocol.Clear
Sheets(sSheet2).btnProtocol.AddItem ("http")
Sheets(sSheet2).btnProtocol.AddItem ("https")
If Sheets(sSheet2).Range("rngProtocol").Value <> "" Then
Sheets(sSheet2).btnProtocol.Value = Sheets(sSheet2).Range("rngProtocol").Value
Sheets(sSheet2).Range("rngProtocol").Value = ""
End If


'Populate the Action button
Sheets(sSheet2).btnAction.Clear
If Sheets(sSheet2).Range("rngAction").Value = "CREATE" Then
Sheets(sSheet2).btnAction.AddItem ("CREATE")
End If
Sheets(sSheet2).btnAction.AddItem ("UPDATE")
Sheets(sSheet2).btnAction.AddItem ("UPDATEDATA")

End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Close down the toolbars on exit
Application.CommandBars(sToolBarTemplateActions).Visible = False
Application.CommandBars(sToolBarDataInputActions).Visible = False
Application.CommandBars(sToolBarStagingAndSubmissionActions).Visible = False
End Sub

Aflatoon
03-23-2013, 06:41 AM
Whatever the value of sToolBarDataInputActions is is not a valid commandbars name. Are you sure the variable still has a value and that it's correct?

raj007
10-08-2013, 10:32 AM
Hello Were you able to fix this issue, I am getting the same error and unable to debug the issuePlease let me know Raj
Hello, I am recieving a "Run-Time error '5': Invalid procedure call or argument" when I try to select my worksheet tab called "Data Input". When I debug the macro, it debugs it to this line: Option ExplicitPrivate Sub Worksheet_Activate() Application.CommandBars(sToolBarDataInputActions).Visible = TrueEnd Sub Would you know why I am getting this? This worksheet is on Excel 2010. Thanks so much

joanp
10-08-2013, 02:25 PM
raj007,

Did you get this issue resolved, please? I'm having the same issue.

Thanks!

raj007
10-15-2013, 01:43 PM
I am still trying to find an answer :-(
raj007, Did you get this issue resolved, please? I'm having the same issue.Thanks!

raj007
10-15-2013, 01:59 PM
Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

joanp
10-15-2013, 02:09 PM
It worked fine when I ran it from within the Excel folder of the PTools folder in Citrix.

Thanks!


Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

portalar
11-01-2013, 10:24 AM
Thanks for posting your solution but where do I find the INIT macro that you mentioned?

Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

Thanks
Art

raj007
11-01-2013, 12:21 PM
It will be present in any Excel to CI.
Just do View Macros on any Excel to Ci sheet and you will see it and then you select and Run.


Thanks for posting your solution but where do I find the INIT macro that you mentioned?

Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

Thanks
Art