View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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.