+ Reply to Thread
Results 1 to 2 of 2

Macro to export file (HELP!!)

  1. #1
    Registered User
    Join Date
    08-25-2004
    Posts
    82

    Macro to export file (HELP!!)

    Hello everyone, first off thanks for your help, here is what i am hoping i can do. Any help is apriciated. Im trying to get this done by tomorrow if possible.

    i need to write a very simple text file with excel macros/vb

    i need to be able to name the file, choose where to save it, make it so the user has no options in the process ( i think i have that part) and put in the file (if possible 1 line of text.

    Is this possible?

    Thanks

    again any help is extreamly helpful

  2. #2
    Registered User
    Join Date
    08-25-2004
    Posts
    82
    So far this is what i have found, it almost works but i need some more help

    here is the code

    Sub CreateAfile()
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("E:\testfile.txt", True)
    a.WriteLine ("This is a test.")
    a.Close
    End Sub

    Sub OpenTextFileTest()
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending, TristateFalse)
    f.Write "Hello world!"
    f.Close
    End Sub

    CreateAFile Works but when i try to run OpenTextFileTest, it errors out, i need to be able to append to a file. CreateAFile Writes over itself everytime it is run.
    thanks for your help

+ 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