Consulting

Results 1 to 10 of 10

Thread: Run-Time Error '5': Invalid procedure call or argument

  1. #1

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

    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:

    [VBA]Option Explicit
    Private Sub Worksheet_Activate()
    Application.CommandBars(sToolBarDataInputActions).Visible = True
    End Sub[/VBA]

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

  2. #2
    The script above is inserted inside the sheet, while this is locatedd in ThisWorkbook

    [VBA]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[/VBA]

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    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?
    Be as you wish to seem

  4. #4
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    4
    Location
    Hello Were you able to fix this issue, I am getting the same error and unable to debug the issuePlease let me know Raj
    Quote Originally Posted by akreidler View Post
    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: [VBA]Option ExplicitPrivate Sub Worksheet_Activate() Application.CommandBars(sToolBarDataInputActions).Visible = TrueEnd Sub[/VBA] Would you know why I am getting this? This worksheet is on Excel 2010. Thanks so much

  5. #5
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    2
    Location
    raj007,

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

    Thanks!

  6. #6
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    4
    Location

    Unhappy

    I am still trying to find an answer :-(
    Quote Originally Posted by joanp View Post
    raj007, Did you get this issue resolved, please? I'm having the same issue.Thanks!

  7. #7
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    4
    Location
    Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

  8. #8
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    2
    Location

    Thanks! Got it working!

    It worked fine when I ran it from within the Excel folder of the PTools folder in Citrix.

    Thanks!

    Quote Originally Posted by raj007 View Post
    Here is the solution to the issue - I should have checked My oracle Support first My Experience:Running the INIT Macro fixed my issue

  9. #9
    VBAX Newbie
    Joined
    Nov 2013
    Posts
    1
    Location
    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

  10. #10
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    4
    Location
    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.

    Quote Originally Posted by portalar View Post
    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

Posting Permissions

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