ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto open text files (https://www.excelbanter.com/excel-programming/310844-auto-open-text-files.html)

Michael Maloney

auto open text files
 
Exploring whether I can create a text file with embedded VBA code that will
allow file to be openned in excel.

Thanks in advance.

--
Michael Maloney

Nick Hodge

auto open text files
 
Michael

Not sure what you mean. You can save a text file as .csv and it will open
automatically in Excel. You can also record/write a macro opening any other
type of text file with the text import wizard, saving this code to your
personal.xls. This would then always be available to re-run every time XL
was opened

VBA embedded in a text file...no

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Michael Maloney" wrote in
message ...
Exploring whether I can create a text file with embedded VBA code that
will
allow file to be openned in excel.

Thanks in advance.

--
Michael Maloney




Michael Maloney

auto open text files
 
VBA embedded in a text file...no

follow-up question:

Since name of text file will change every time, can a macro (VBA) be created
to open to most recent (date/time stamp) file in a particular folder?

Thanks again. Mike


"Nick Hodge" wrote:

Michael

Not sure what you mean. You can save a text file as .csv and it will open
automatically in Excel. You can also record/write a macro opening any other
type of text file with the text import wizard, saving this code to your
personal.xls. This would then always be available to re-run every time XL
was opened

VBA embedded in a text file...no

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Michael Maloney" wrote in
message ...
Exploring whether I can create a text file with embedded VBA code that
will
allow file to be openned in excel.

Thanks in advance.

--
Michael Maloney





Nick Hodge

auto open text files
 
Michael

Does it have to be totally automated in this way. If you just want a
different file fed into the macro each time then at the top (below Sub
xxxxx()) put these lines

Dim sFile As String
sFile = Application.GetOpenFilename(, , "Select an import file")

Then replace the file name you have in the macro with sFile. (Take out the
"" too)

This will now present a box similar to the file open box. It takes the
selection into the sFile variable and uses that in your code. You can
further refine the files it shows in the open dialog box but currently it
shows 'All Files (*.*)'

Let me know how you get on



--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Michael Maloney" wrote in
message ...
VBA embedded in a text file...no

follow-up question:

Since name of text file will change every time, can a macro (VBA) be
created
to open to most recent (date/time stamp) file in a particular folder?

Thanks again. Mike


"Nick Hodge" wrote:

Michael

Not sure what you mean. You can save a text file as .csv and it will
open
automatically in Excel. You can also record/write a macro opening any
other
type of text file with the text import wizard, saving this code to your
personal.xls. This would then always be available to re-run every time
XL
was opened

VBA embedded in a text file...no

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Michael Maloney" wrote in
message ...
Exploring whether I can create a text file with embedded VBA code that
will
allow file to be openned in excel.

Thanks in advance.

--
Michael Maloney








All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com