+ Reply to Thread
Results 1 to 3 of 3

Writing text string with imbedded quotes to a text stream

  1. #1
    John Wirt
    Guest

    Writing text string with imbedded quotes to a text stream

    I want to write a series of comand line strings having imbedded quotes like
    this to a command file (.cmd),

    erase "C:\Essay\FE8 Teachers\Code Files.SAS" /Q

    Can this be done? (I'm sure it can but I cannot figure out how to do it.)
    The quotes are necessary because of the possiblity of spaces in parameters of
    the command written to the export file.

    The key VBA statement that writes these command line strings is:

    OutArray(I) = "erase " & "'" & cel(I, 3) & cel(I, 2) & "'" & " /Q" &
    vbCrLf

    The resulting .cmd file will be executed from a command line window.

    As you can see from the code, I am currently using the string "'" to insert
    'quotes' around the command lline parameters.

    Unfortunately, this does not work. Command line parameters must be brackets
    with full fledged quotes (command "param1" "param2") and not asn apostrophe.

    How can I include quotes (") in an output string written to a textfile in VBA?

    Thank you.

    John Wirt



    T




  2. #2
    Fred
    Guest

    Re: Writing text string with imbedded quotes to a text stream

    John, two quotes ("") within a string will result in one being output.
    try:

    OutArray(I) = "erase " & """" & cel(I, 3) & cel(I, 2) & """" & " /Q" &
    vbCrLf


    Fred


    "John Wirt" <[email protected]> wrote in message
    news:[email protected]...
    >I want to write a series of comand line strings having imbedded quotes like
    > this to a command file (.cmd),
    >
    > erase "C:\Essay\FE8 Teachers\Code Files.SAS" /Q
    >
    > Can this be done? (I'm sure it can but I cannot figure out how to do it.)
    > The quotes are necessary because of the possiblity of spaces in parameters
    > of
    > the command written to the export file.
    >
    > The key VBA statement that writes these command line strings is:
    >
    > OutArray(I) = "erase " & "'" & cel(I, 3) & cel(I, 2) & "'" & " /Q" &
    > vbCrLf
    >
    > The resulting .cmd file will be executed from a command line window.
    >
    > As you can see from the code, I am currently using the string "'" to
    > insert
    > 'quotes' around the command lline parameters.
    >
    > Unfortunately, this does not work. Command line parameters must be
    > brackets
    > with full fledged quotes (command "param1" "param2") and not asn
    > apostrophe.
    >
    > How can I include quotes (") in an output string written to a textfile in
    > VBA?
    >
    > Thank you.
    >
    > John Wirt
    >
    >
    >
    > T
    >
    >
    >




  3. #3
    John Wirt
    Guest

    Re: Writing text string with imbedded quotes to a text stream

    Thansk. will try. John
    I tried three (""") but it didn't work.

    "Fred" <leavemealone@home> wrote in message
    news:[email protected]...
    > John, two quotes ("") within a string will result in one being output.
    > try:
    >
    > OutArray(I) = "erase " & """" & cel(I, 3) & cel(I, 2) & """" & " /Q" &
    > vbCrLf
    >
    >
    > Fred
    >
    >
    > "John Wirt" <[email protected]> wrote in message
    > news:[email protected]...
    > >I want to write a series of comand line strings having imbedded quotes

    like
    > > this to a command file (.cmd),
    > >
    > > erase "C:\Essay\FE8 Teachers\Code Files.SAS" /Q
    > >
    > > Can this be done? (I'm sure it can but I cannot figure out how to do

    it.)
    > > The quotes are necessary because of the possiblity of spaces in

    parameters
    > > of
    > > the command written to the export file.
    > >
    > > The key VBA statement that writes these command line strings is:
    > >
    > > OutArray(I) = "erase " & "'" & cel(I, 3) & cel(I, 2) & "'" & " /Q" &
    > > vbCrLf
    > >
    > > The resulting .cmd file will be executed from a command line window.
    > >
    > > As you can see from the code, I am currently using the string "'" to
    > > insert
    > > 'quotes' around the command lline parameters.
    > >
    > > Unfortunately, this does not work. Command line parameters must be
    > > brackets
    > > with full fledged quotes (command "param1" "param2") and not asn
    > > apostrophe.
    > >
    > > How can I include quotes (") in an output string written to a textfile

    in
    > > VBA?
    > >
    > > Thank you.
    > >
    > > John Wirt
    > >
    > >
    > >
    > > T
    > >
    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1