#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto open workbook(s)? Shek5150 Excel Discussion (Misc queries) 6 August 29th 08 05:58 PM
Auto Open problem Jim Excel Discussion (Misc queries) 1 December 7th 07 11:59 AM
Auto open a .xlt template Khoa New Users to Excel 2 July 26th 06 06:54 AM
how do you switch from auto open Jay Excel Discussion (Misc queries) 3 July 18th 05 04:29 PM
Auto Open Syed Zeeshan Haider Excel Discussion (Misc queries) 2 June 1st 05 03:39 PM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"