ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   import package from (https://www.excelbanter.com/excel-programming/404081-import-package.html)

Jeremy R.

import package from
 
I have a certain package that I import from the same location on multiple
files each week.

I recorded a macro to import the file but the macro does not automatically
import the file from the location and filename I used when recording the
macro. The macro stops when it gets to the object packager box.

I would like it to automatically select the location and name of the file
since it never changes and then update the form.

What VB code could I use to do this?
Thanks in advance.

joel

import package from
 
You can do something like the code below. Put the filenames into an array

Sub test()

Folder = "c:\temp\test\"
Files = Array( _
"abc_1.xls", _
"abc_2.xls", _
"abc_3.xls", _
"abc_4.xls")

For Each file In Files
Workbooks.Open Filename:=Folder & file
ActiveWorkbook.Close
Next file

End Sub

"Jeremy R." wrote:

I have a certain package that I import from the same location on multiple
files each week.

I recorded a macro to import the file but the macro does not automatically
import the file from the location and filename I used when recording the
macro. The macro stops when it gets to the object packager box.

I would like it to automatically select the location and name of the file
since it never changes and then update the form.

What VB code could I use to do this?
Thanks in advance.



All times are GMT +1. The time now is 11:30 AM.

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