J
Jake
Hi
Thanks to a generous poster I now have a great bit of code to use in a macro
for Excel which saves a text file (I'm no VBA programmer so this was really
helpful), i.e.:
Open "Test.txt" For Output As #1
(rest of code)
My problem now is this:
The macro saves test.txt to Excel's current active folder, rather than the
folder that the current workbook is contained in.
For example, if I last saved an Excel workbook to c:\workbooks\, and the
workbook that I have open exists in c:\workbooks\workbook1\, when I run the
macro it saves the text file in c:\workbooks\. If I save over my current
workbook (File -> Save As, then overwrite the workbook) it would seem that
Excel's working folder changes to c:\workbooks\workbook1, and that's where
the macro now saves text.txt.
How do I make it so that the macro saves text.txt in the same folder as the
workbook that contains it?
Thanks in advance
Jake
Thanks to a generous poster I now have a great bit of code to use in a macro
for Excel which saves a text file (I'm no VBA programmer so this was really
helpful), i.e.:
Open "Test.txt" For Output As #1
(rest of code)
My problem now is this:
The macro saves test.txt to Excel's current active folder, rather than the
folder that the current workbook is contained in.
For example, if I last saved an Excel workbook to c:\workbooks\, and the
workbook that I have open exists in c:\workbooks\workbook1\, when I run the
macro it saves the text file in c:\workbooks\. If I save over my current
workbook (File -> Save As, then overwrite the workbook) it would seem that
Excel's working folder changes to c:\workbooks\workbook1, and that's where
the macro now saves text.txt.
How do I make it so that the macro saves text.txt in the same folder as the
workbook that contains it?
Thanks in advance
Jake