By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 511 - GetCommandLine() - udf



Private Declare Function GetCommandLine Lib "kernel32" Alias _
   "GetCommandLineA" () As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" _
    (ByVal lpString1 As String, ByVal lpString2 As Long) As Long

Private Function CommandLine() As String
    Dim lpStr As Long, i As Long
    Dim buffer As String

    lpStr = GetCommandLine()
    buffer = Space$(512)
    lstrcpy buffer, lpStr
    buffer = Left$(buffer, InStr(buffer & vbNullChar, vbNullChar) - 1)
    CommandLine = buffer
End Function


   Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit