I need to pass the user's defined date range from an access form to an Excel spreadsheet. The spreadsheet is a pivot table based on an external data source (a dynamically built Access 2003 table) Everything seems to be working properly except the dates from the access form are not getting into the spreadsheet. I thought this worked at initially, but maybe it never did (it's in testing). Anyhow, this is my code. Seems like this should be easy, but I just can't figure it out. What am I missing?
'initiate Excel & open (pivot table) workbook
Dim XL As Object, WB As Object
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open(strPathAndFile)
XL.Application.Visible = True
'pass dates selected from access form to excel worksheet
WB.Sheets(1).Range("a2").Value = "Selected Date Range: " & CDate(Me!StartDate) & " through " & CDate(Me!EndDate)
XL.Run "RefreshData"
Linda in MN
'initiate Excel & open (pivot table) workbook
Dim XL As Object, WB As Object
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open(strPathAndFile)
XL.Application.Visible = True
'pass dates selected from access form to excel worksheet
WB.Sheets(1).Range("a2").Value = "Selected Date Range: " & CDate(Me!StartDate) & " through " & CDate(Me!EndDate)
XL.Run "RefreshData"
Linda in MN