Workbook Open Macro

N

natarajr

This below macro used to work in the older version of excel. It does
not work now. Any help is appreciated!!
Thanks

Sub OpenPrintMacro()

Dim Fname

For i = 1 to 5

Fname = Worksheets("FileNames").Range("a"+i).value
Workbooks.open.filename:= "C:\My Documents\Files\" & Fname
ActiveWindow.selectedsheets.Printout copies:=1
ActiveWorkbook.close

Next i
End Sub




WorkSheet FileNames

Range a1 = Test1.xls
Range a2 = Test2.xls
Range a3 = Test3.xls
so on and so forth.............
 
D

Dave Peterson

It sure looks like it would work if the values in the A1:A5 corresponded to
real filenames in "c:\my documents\files".

I'd check that first.

If that isn't it, you may want to post what happens when it fails.
 

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