0

I tried to open a csv file as txt format from a VBA macro like this without success:

Open "F:\MyPlace\Content\1 - IMPORTER.csv" For Output As #1

My goal is to open this file, (as stated) outside the excel. Just like you open a txt file.

Would this be possible? How?

bpy
  • 1,150
  • 10
  • 27
  • Do you want the contents of the `.csv` to be input to a worksheet or do you want to open the file with something like *Notepad* – Gary's Student Aug 21 '20 at 13:15
  • csv is a text file. Just drag&drop it onto Notepad. – Paul Ogilvie Aug 21 '20 at 13:26
  • Would you like to extract and process (input output content) the extracted string? Or only opening it in a text editor? Which looks less probable to me, looking to your code... – FaneDuru Aug 21 '20 at 13:27
  • Besides, you open the file for output, so can write anything to it you want with `write #1` or `print #1` – Paul Ogilvie Aug 21 '20 at 13:28
  • What would you like doing **after opening** it? In this way, maybe we will better understand your question... – FaneDuru Aug 21 '20 at 13:34

1 Answers1

1

Give this a try, please:

Sub WHATEVER()
    CreateObject("Shell.Application").Open ("C:\Users\beckj\whatever.txt")
End Sub
Joe Beck
  • 401
  • 2
  • 13
  • Just one more thing... (if I may ask..?): Do you know how can I save and close this object after a certain time? – bpy Aug 21 '20 at 13:55
  • @bpy , that's interesting. I've never tried that. But it appears that this works: https://stackoverflow.com/a/50452247/14010152 – Joe Beck Aug 21 '20 at 14:00