-
Solved: Open workbook when excel starts
I found the following code in prevoius thread "Open workbook based on specific date" could the code be modified to open the workbook whenever excel is opened
MANY thanks
[VBA]
Option Explicit
Private Sub Workbook_Open()
ProcessFiles
End Sub
Sub ProcessFiles()
Dim MyPath As String, MyName As String
Dim Sheet As String, Address As String
Dim d As Long
MyPath = "C:\AAA\"
MyName = "TestDate.xls"
For d = 10 To 30
If GetData(MyPath, MyName, "Sheet1", "A" & d) = Date Then
Workbooks.Open (MyPath & MyName)
Exit For
End If
Next
End Sub
Private Function GetData(Path, File, Sheet, Address)
Dim Data As String
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & _
Range(Address).Range("A1").Address(, , xlR1C1)
GetData = ExecuteExcel4Macro(Data)
End Function
[/VBA]
-
One way to do this would be to specify that the file be opened at startup by excel. Under Tools>Options you can specify files to open at startup. See below.
Brandtrock
-
If you put that code in the Personal.xls file, it will always happen at Excel startup, as that file (any any others in the XLSTART directory) are opened as Excel starts.
-
MANY THANKS I HAD FORGOTTEN ABOUT THE MXL START UP FOLDER
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules