Results 1 to 7 of 7

Thread: getcommandlinea

  1. #1
    bond_b4
    Guest

    getcommandlinea

    I am using this (api?) in Excel 97 on Win 95 machine. It works great for retrieving parms. However, my VBA code bombs excel when I run this on Winy2k and Office Y2k. Anyone know if there is a work around? Anyone else retrieving parms in VBA code?

  2. #2
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: getcommandlinea

    If I understand you correctly you want a kind of a command line to input values at runtime:

    In VBA you have 3 alternatives:

    Inputbox _Function_ where you input a string
    Inputbox _Method_ i.e. Application.Worksheetfunction.InputBox(...), where you can specify the type of input data.
    Msgbox Function which waits for the user to click a button and returns an integer of the clicked button.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: getcommandlinea

    The api for Win95 is 16 bit. The closest I can come in Win32 is this:

    Public Declare Function CommandLineToArgv Lib "shell32" Alias "CommandLineToArgvW" (ByVal lpCmdLine As String, pNumArgs As Integer) As Long

    However, VBA has a function called Command() that returns a variant containing the argument following the /cmd switch in a command line. Even though the help files says it isn't available in Office applications, it works nicely in VBA code. I assume they mean it isn't available from the UI. I can't recall whether this was available in Office 97 or not, but it seems to me it was.
    Charlotte

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: getcommandlinea

    FYI, yes it's available in 97.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: getcommandlinea

    What API is it in? It isn't in the Windows32 API unless it's so well hidden it doesn't show up in the API viewer.
    Charlotte

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: getcommandlinea

    Charlotte,

    It's built in to the UI.

    Try ?Command()

    in the Word 97 immediate window. Unless you started Word with something on the command line, you get a line feed.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: getcommandlinea

    OK, we just have a vocabulary problem. The IDE in Office isn't considered part of the UI, probably because it's where the developers play. In fact, I mentioned using the Command() function, which is VB/VBA by the way rather than Windows or Office UI. I assume its a wrapper for the Win32 API call GetCommandLine, although I accidentally pasted the wrong API call in my earlier post.
    Charlotte

Posting Permissions

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