I have a workbook called "Sales by Dept "and when I open this , I would like another workbook called "Intercompany Sales.xls" in C:\my documents to open automatically
See my code below which I have saved into "This Workbok" module but the file "Intercompany Sales.xls" does not automatically open
It would be appreciated if someone could amen my code accordingly
See my code below which I have saved into "This Workbok" module but the file "Intercompany Sales.xls" does not automatically open
Code:
Private Sub Workbook_Open()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "C:\My Documents\" 'Change folder location
MyFile = Dir(MyFolder & "\*intercompany*.xls")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile
MyFile = Dir
Loop
End Sub
It would be appreciated if someone could amen my code accordingly