ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open file from vba (https://www.excelbanter.com/excel-programming/294885-open-file-vba.html)

Juan[_3_]

Open file from vba
 
Hi all...

I have a macro that extracts a series of data that comes
on text format on several files and exports them into a
workbook, it used to be arround 30 files each time so I
renamed them: 1.doc, 2.doc, 3.doc and so on so that the
macro could find them and open them. now I need to rename
arround 600 files, is there a way to open a file from vba
regardless of the name? OPEN NEXT or something like that??
Or can anyone sugest a macro to rename all the files into
the previos format (1.doc, 2.doc,...,2000.doc)?

Any help is greatly appreaciated...

regards
JS

Juan Pablo González

Open file from vba
 
Juan wrote:
Hi all...

I have a macro that extracts a series of data that comes
on text format on several files and exports them into a
workbook, it used to be arround 30 files each time so I
renamed them: 1.doc, 2.doc, 3.doc and so on so that the
macro could find them and open them. now I need to rename
arround 600 files, is there a way to open a file from vba
regardless of the name? OPEN NEXT or something like that??
Or can anyone sugest a macro to rename all the files into
the previos format (1.doc, 2.doc,...,2000.doc)?

Any help is greatly appreaciated...

regards
JS


You could adapt the code from he

http://www.contextures.com/xlfaqMac.html#LoopBooks

to use *.doc instead of *.xls

--
Regards,

Juan Pablo González



Juan[_3_]

Open file from vba
 
Beautiful

Works great, thanks Juan!!!



-----Original Message-----
Juan wrote:
Hi all...

I have a macro that extracts a series of data that comes
on text format on several files and exports them into a
workbook, it used to be arround 30 files each time so I
renamed them: 1.doc, 2.doc, 3.doc and so on so that the
macro could find them and open them. now I need to

rename
arround 600 files, is there a way to open a file from

vba
regardless of the name? OPEN NEXT or something like

that??
Or can anyone sugest a macro to rename all the files

into
the previos format (1.doc, 2.doc,...,2000.doc)?

Any help is greatly appreaciated...

regards
JS


You could adapt the code from he

http://www.contextures.com/xlfaqMac.html#LoopBooks

to use *.doc instead of *.xls

--
Regards,

Juan Pablo González


.



All times are GMT +1. The time now is 01:39 PM.

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