Create txt file with Excel VBA macro

Solved
thepatatane Posted messages 224 Status Member -  
 Nico -
Hello,
I would like to create an Excel macro that creates a txt file containing the content of a cell from the Excel project.
And that it is opened at the same time.
Thank you in advance.

Configuration: Windows 7 / Firefox 15.0.1

3 answers

  1. f894009 Posted messages 17417 Registration date   Status Member Last intervention   1 717
     
    Hello,

    Sub create_TXT() Close path = "C:\directory" Open path & "File.txt" For Output As #1 Print #1, Worksheets("Sheet1").Range("A1") Close End Sub 


    And that it be opened at the same time.
    12
    1. thepatatane Posted messages 224 Status Member 4
       
      Thank you for your response, but I’m just starting with VBA, and it’s not working :(
      And for "And that it should be opened at the same time. ????????" I mean that just after it is created, it should be opened, but that’s not a big deal.
      0
    2. thepatatane Posted messages 224 Status Member 4
       
      There is an error
      "runtime error '75': path/file access error"
      0