Results 1 to 9 of 9

Thread: [RESOLVED] Show All String Characters

Threaded View

  1. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Show All String Characters

    explorer will append (& prepend) quotes to all filepaths containing spaces (only), these will be in your command string

    if you are passing multiple files, you can not split on space alone (unless you are sure that there are no spaces within the filepath)

    i have posted 2 slightly different codes in the forums, recently, which should be able to return the filenames from the command string, i will see if i can find either

    this example is not specifically for command string, but should work
    vb Code:
    1. q = Chr(34)
    2. d = " "
    3. myarr = Split(Command, d)
    4. For i = 0 To UBound(myarr)
    5.     If i > UBound(myarr) Then Exit For
    6.     If InStr(myarr(i), q) > 0 Then
    7.         j = 1
    8.         Do
    9.             myarr(i) = myarr(i) & d & myarr(i + j)
    10.             If InStr(myarr(i + j), q) > 0 Then
    11.                 myarr(i) = Replace(myarr(i), q, "")  
    12.                 For k = i + 1 To UBound(myarr) - i
    13.                     myarr(k) = myarr(k + j)
    14.                 Next
    15.                 ReDim Preserve myarr(k - 1)
    16.                 Exit Do
    17.             End If
    18.             j = j + 1
    19.         Loop
    20.     End If
    21. Next

    the other i did, was to do exactly what you are wanting and checked for valid files, do search on command
    Last edited by westconn1; Aug 7th, 2010 at 11:55 PM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

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