need help with VB script xls to txt

Discussion in 'Programming' started by rstruble, Dec 3, 2009.

  1. rstruble

    rstruble New Member

    Joined:
    Oct 7, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Windows Desktop Support
    Location:
    In a LinuxBox
    Hello,

    I am trying to creat a script in VB that will take data from specific columns in an Excel sheet and populate it into a text document that i can then send as a reply in Outlook. I have the script that will creat the basic "spine" of the text document but i can not figure out how to pull the data from the Excel sheet.

    here is what i have:

    Code:
    Set objFSO = CreateObject("Scripting.FileSystemObject")    
    Set objNewFile = objFSO.CreateTextFile("C:\test2.txt")
        objNewFile.Close
    strLogFile = "C:\test2.txt"
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(strLogFile, 8)
            objFile.WriteLine "Dear <NAME>"
            objFile.WriteLine "  "
            objFile.WriteLine "This email is in response to your feedback message:"
            objFile.WriteLine "  "
            objFile.WriteLine "Feedback Message ID:        <___>"
            objFile.WriteLine "  "
            objFile.WriteLine "Submission Date:        <Date>"
            objFile.WriteLine "  "
            objFile.WriteLine "RE:        <Description>"
            objFile.WriteLine "  "
            objFile.WriteLine "We appreciate your feedback. We are researching your request and looking into possible solutions for your suggestions."
            objFile.WriteLine "   "
            objFile.WriteLine "Thank you,"
            objFile.WriteLine "  "
            objFile.WriteLine "NAME"
            objFile.WriteLine "Title"
    
            WScript.Quit
    objFile.Close
    
    WScript.Quit(0)
    
    i would like to fill the <> with specific data from the excel sheet and i would also like to have the script create the text file with the name of the person i will be replying to, also in the excel sheet. any help would be greatly appreciated.

    Thank you
    RStruble
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice