CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2013
    Posts
    4

    Invalid Procedure or Call

    Hey NEwbie here,

    I am trying to add a button to excel to open device manager and tried this however I get a "invalid call or procedure" error. Please advise. thanks

    Quote Originally Posted by AutomationBoy View Post
    I was looking for an answer to the same problem. When I searched for an answer the only hits I found were to the questions, but no answers. So after I researched what a .msc file was and realized what it took to launch it, I answered one of them for future reference.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [VB] Open the Device Manager

    while Device Manager is running, check PROCESS LIST for the name, and then search for the file location. You can look up how to shell that call from Excel
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Oct 2013
    Posts
    4

    Re: [VB] Open the Device Manager

    It looks correct, mmc.exe is running and devmgmt.msc is in the system32 folder

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Invalid Procedure or Call

    [ Moved To Separate Thread ]

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Invalid Procedure or Call

    try

    Code:
    Shell "devmgmt.msc"
    with the full path
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Oct 2013
    Posts
    4

    Re: Invalid Procedure or Call

    I tried the following, but still the same error:
    Code:
    Sub Open_Device_Mgr()
    Dim RetValue As Long
    Shell "C:\WINDOWS\system32\devmgmt.msc"
    'RetValue = Shell("C:\WINDOWS\system32\mmc.exe C:\WINDOWS\system32\devmgmt.msc")
    End Sub

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Invalid Procedure or Call

    try it with CMD.exe first. Might need the flag to keep it open
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Oct 2013
    Posts
    4

    Re: Invalid Procedure or Call

    yep, thats the one. thanks for your help

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured