Auto Open

T

Todd

Am I making this to hard? I want to open all documents
linked to my main documents. I want to open the main
document and be select to open all the liked documents in
one step.

I have been working with a macro that can open documents
by name but I want the whole directory to open and (if
possible) open as minimized. If theres an easier way that
would be great too.

Heres what I have so far.

Sub AllFiles()
'will open all files in a directory
Dim myPath As String, myFile As String
myPath = "C:\desktop\test"
myFile = Dir(myPath & "*.xls")
Workbooks.Open myPath & myFile
ActiveWindow.WindowState = xlMinimized
End Sub


to open a single document I have (this works):

Sub OpenOneFile()
Workbooks.Open ("C:\WINDOWS\Desktop\test\book4.xls")
ActiveWindow.WindowState = xlMinimized
End Sub
 
B

Bill Li

I think you should add a loop in the macro such as FOR or
DO loop.

Best Regards

Bill
 
T

Todd

I am working on the code but I get the message "sub or
function not defined". How do I figure out what is not
defined and how to define it?

The ProcessFile MyFile is highlighted in blue, I assume
its the problem?

Todd
 

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