+ Reply to Thread
Results 1 to 4 of 4

Write cells from excel cells to notepad files

  1. #1
    Registered User
    Join Date
    02-08-2010
    Location
    Kent
    MS-Off Ver
    Excel 2007
    Posts
    10

    Cool Write cells from excel cells to notepad files

    Hi,

    Hope you can help.

    I have used some VB to create a macro that places the contetnts of an excel cell into an existing notepad file called NewUser.txt. It is working well, however inverted commas apear before and after the contents of the cells after they have been written to notepad.
    Is there anyhing I can do to stop the inverted commas appearing?

    Also are there any risks with what I have written in terms of the system writting data and using #1 at the same time as my macro runs? A friend has suggested using 'Put' instead of 'Write' however I do not know how to do this.

    The code I am using is as follows:
    Please Login or Register  to view this content.

    Thanks in advance for your help
    Last edited by Leith Ross; 02-08-2010 at 07:15 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Write cells from excel cells to notepad files

    Hello pacman76,

    Welcome to the Forum!

    I am not sure what you are referring to when you say inverted commas. Can you provide an example. In the mean time, here is some information about how the Write # statement saves data.

    The Write # statement follows several universal assumptions so the data can always be read and correctly interpreted regardless of locale:
    1. Numeric data is always written using the period as the decimal separator.
    2. For Boolean data, either #TRUE# or #FALSE# is printed. The True and False keywords are not translated, regardless of locale.
    3. Date data is written to the file using the universal date format. When either the date or the time component is missing or zero, only the part provided gets written to the file.
    4. Nothing is written to the file if outputlist data is Empty. However, for Null data, #NULL# is written.
    5. If outputlist data is Null data, #NULL# is written to the file.
    6. For Error data, the output appears as #ERROR errorcode#. The Error keyword is not translated, regardless of locale.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-08-2010
    Location
    Kent
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Write cells from excel cells to notepad files

    Hi,

    If the data in cell A1 = Hello

    after I run the macro this is written to notepad as, "Hello" .... with inverted commas.

    I dont want the inverted commas.

  4. #4
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Write cells from excel cells to notepad files

    Hi pacman76

    What you need to do, is change 'Write' in your code to 'Print'. And that should solve your inverted comma/quotes problem.

    Please Login or Register  to view this content.
    Last edited by excelxx; 02-09-2010 at 08:09 AM. Reason: inserting code

+ 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