Greetings All ~
I'm currently running an Excel macro from the click event on an Access UI.
Below is the code I use to open the Excel Workbook containing the event procedure.
Code:
Dim AppExcel As Excel.Application
Dim MyWorkbook As Excel.Workbook
Path = "C:\Users\AA123456\Desktop\"
MyFile = Path & "Foo.xlsm"
Set AppExcel = CreateObject("Excel.Application")
Set MyWorkbook = AppExcel.Workbooks.Open(MyFile)
AppExcel.Visible = False
AppExcel.Run "Module1.SalesRprts"
The procedure in Excel calls the requested file with this code
Code:
Path = "N:\Sales Management\Internal\@DeptSales\Sales Reports\"
MyFile = Path & "Regional_Sales_ & Format(Date, "yyyy-mm-dd") & "*.xlsx"
Application.Workbooks.Open (MyFile)
My question is this ~ Can I change the Date part of the above code to a date variable that is set in Access?
Something like
Code:
Path = "N:\Sales Management\Internal\@DeptSales\Sales Reports\"
MyFile = Path & "Regional_Sales_ & Format('" & AccessTextBoxValue & "', "yyyy-mm-dd") & "*.xlsx"
As always thank you for any help