I have a code that I use to export a schedule created in Access to Excel. I have to manually open the excel file before exporting, otherwise I get an error. Is there any way to open it automatically before the export so that the users don't have to remember to open it. I am including the relevant part of the code.
Set xlSheet = GetObject(CurrentPath & "\Weekly Schedule.xls"
Set SchedQuery = CurrentDb.OpenRecordset("qryWeeklySchedule", dbOpenDynaset)
SchedQuery.MoveFirst
x = 8
xlSheet.Sheets(1).Activate
With xlSheet.ActiveSheet
.Range("A8:H47"
.ClearContents
.Range("A64:H109"
.ClearContents
Do While Not SchedQuery.EOF
Select Case x
Case Is = 16
.Cells(x, 1).Value = " "
x = x + 1
Case Is = 18
.Cells(x, 1).Value = "Days"
x = x + 1
Case Is = 38
.Cells(x, 1).Value = "Other"
x = x + 1
Thanks
Set xlSheet = GetObject(CurrentPath & "\Weekly Schedule.xls"
Set SchedQuery = CurrentDb.OpenRecordset("qryWeeklySchedule", dbOpenDynaset)
SchedQuery.MoveFirst
x = 8
xlSheet.Sheets(1).Activate
With xlSheet.ActiveSheet
.Range("A8:H47"
.Range("A64:H109"
Do While Not SchedQuery.EOF
Select Case x
Case Is = 16
.Cells(x, 1).Value = " "
x = x + 1
Case Is = 18
.Cells(x, 1).Value = "Days"
x = x + 1
Case Is = 38
.Cells(x, 1).Value = "Other"
x = x + 1
Thanks