+ Reply to Thread
Results 1 to 4 of 4

Writing number instead of string to text file

  1. #1
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    192

    Writing number instead of string to text file

    Hello, I have the following code saving variables for my workbook to be recalled in case of a problem. The problem I am having is that my workbook is incrimenting the shifts by adding 1 then looping. The thing is, the below code is writing the shift (last number written which is s8) with "" arround it.
    I am using the WRITE function which I believe is doing this. I would use the print function but then my other variables dont record correctly..

    Currently the below code writes a file containg information formatted like this:
    "Product","d:\334amd\","Tech.xls","c:\","8","1018","1018_23_21","3"

    How can I make all the variables write correctly like this:
    "Product","d:\334amd\","Tech.xls","c:\","8","1018","1018_23_21",3



    Please Login or Register  to view this content.
    I tried using Write #200, s1, s2, s3 ,s4 ,s5 ,s6 ,s7
    and then print s8 but it puts s8 on a new line. Also, there is no comma..
    Last edited by clayton; 04-10-2008 at 11:54 PM.

  2. #2
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    192
    OK then. A much simpler question.

    How can I write to a text file and make the written text NOT have "" marks around it?

    Should I open, write, close, open for append, print to get the results I'm trying to get in the above example?

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by clayton
    OK then. A much simpler question.

    How can I write to a text file and make the written text NOT have "" marks around it?

    Should I open, write, close, open for append, print to get the results I'm trying to get in the above example?
    Hi,

    How about having the macro add a new single sheet workbook, copy the variables to that workbook and then finish off by saving it as a .csv file. Admittedly the values will be comma separated rather than "" separated, but is that a problem?

    Rgds

  4. #4
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    192
    Quote Originally Posted by Richard Buttrey
    Hi,

    How about having the macro add a new single sheet workbook, copy the variables to that workbook and then finish off by saving it as a .csv file. Admittedly the values will be comma separated rather than "" separated, but is that a problem?

    Rgds
    Thank you for your reply. I figured it out. Seem so simple now lol

    I was trying to compare a string to a number and of course that won't work.
    I ended up with the following to make it work for me.
    Please Login or Register  to view this content.
    Then everything started working :D

+ 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