Sandra Smith
asked on
Open all workbooks with name in a particular pattern
I have an ACCESS 2003 process that, when the user hits the Open button, it opens ALL Excel workbooks that have a particular name pattern. I can open one, but I need to loop through the folder and open everyone with this pattern.
Private Sub cmdTodaysWorkbook_Click()
'/SS - Opens all workbook created with today's date.
Dim xlApp As Excel.Application
Dim wbk As Workbook
Dim strExistingFileName As String
Dim fld As Object
Dim strSource As String
strExistingFileName = "\\SF1\User1\shared\ATMVis alosses\AT MVisaLosse sTST_" & Format(Now, "mm-dd-yyyy") & ""
Set xlApp = New Excel.Application
xlApp.Visible = True
For Each fld In strSource.SubFolders
Set wbk = xlApp.Workbooks.Open(strEx istingFile Name & "*.xlsx")
xlApp.Workbooks.Open (strExistingFileName & "*.xlsx")
Next
xlApp.WindowState = xlMaximized
Set xlApp = Nothing
End Sub
Private Sub cmdTodaysWorkbook_Click()
'/SS - Opens all workbook created with today's date.
Dim xlApp As Excel.Application
Dim wbk As Workbook
Dim strExistingFileName As String
Dim fld As Object
Dim strSource As String
strExistingFileName = "\\SF1\User1\shared\ATMVis
Set xlApp = New Excel.Application
xlApp.Visible = True
For Each fld In strSource.SubFolders
Set wbk = xlApp.Workbooks.Open(strEx
xlApp.Workbooks.Open (strExistingFileName & "*.xlsx")
Next
xlApp.WindowState = xlMaximized
Set xlApp = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sandra