Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto Open
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto Open
I think you should add a loop in the macro such as FOR or
DO loop. Best Regards Bill -----Original Message----- 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 . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto Open
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 -----Original Message----- Sub AllFiles() 'will open all files in a directory Dim myPath As String, MyFile As String myPath = "C:\desktop\test" MyFile = Dir(myPath & "*.xls") DO WHILE MyFile <"" ProcessFile MyFile MyFile = Dir() Loop End Sub Sub ProcessFile(FileName as String) DIM WB as Workbook SET WB = Workbooks.Open(FileName) ''' do whatever WB.Save WB.Close SET WB = Nothing End Sub HTH Patrick Molloy Microsoft Excel MVP -----Original Message----- 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 . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto open workbook(s)? | Excel Discussion (Misc queries) | |||
Auto Open problem | Excel Discussion (Misc queries) | |||
Auto open a .xlt template | New Users to Excel | |||
how do you switch from auto open | Excel Discussion (Misc queries) | |||
Auto Open | Excel Discussion (Misc queries) |