import package from

J

Jeremy R.

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.
 
J

Joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top