T
trevorC via AccessMonster.com
I can delete a sheet using the code below, is it possible to automate this
process? To create this report takes about 5 mins to proccess all the sheets
and generate a summary, after this i need to delete the scratch pad sheets
and continue the automation and sent the report with Outlook.
Dim AppOutLook
Dim MailOutLook
Dim olmailItem
Set AppOutLook = CreateObject("Outlook.Application")
Set MailOutLook = AppOutLook.CreateItem(olmailItem)
Dim Excel_Application As Excel.Application
Dim Excel_Workbook As Excel.Workbook
Dim Current_Worksheet As Excel.Worksheet
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Weekly report
for", gg, True
Set Excel_Workbook = GetObject(gg)
Set Excel_Application = Excel_Workbook.Parent
Excel_Application.WindowState = xlMinimized
Excel_Application.Visible = True
Excel_Workbook.Windows(1).Visible = True
Excel_Application.Worksheets.Add
Excel_Workbook.Worksheets(1).Name = "Summary"
....
Excel_Workbook.Worksheets(15).Name = "Scratch Pad1"
....
Excel_Workbook.Worksheets("Scratch Pad1").Delete
The above line causes excel to popup a msgbox requesting confirmation to
delete the sheet, This stops the automation. is it possible to get around
this by using sendkeys ?
Could it be similar to the following ?
With MailOutLook
.To = to_List
.Subject = "Weekly Status Report"
.Attachments.Add gg
.Body = "Please find attached the weekly report."
.Display
SendKeys "%{ENTER}", True
process? To create this report takes about 5 mins to proccess all the sheets
and generate a summary, after this i need to delete the scratch pad sheets
and continue the automation and sent the report with Outlook.
Dim AppOutLook
Dim MailOutLook
Dim olmailItem
Set AppOutLook = CreateObject("Outlook.Application")
Set MailOutLook = AppOutLook.CreateItem(olmailItem)
Dim Excel_Application As Excel.Application
Dim Excel_Workbook As Excel.Workbook
Dim Current_Worksheet As Excel.Worksheet
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Weekly report
for", gg, True
Set Excel_Workbook = GetObject(gg)
Set Excel_Application = Excel_Workbook.Parent
Excel_Application.WindowState = xlMinimized
Excel_Application.Visible = True
Excel_Workbook.Windows(1).Visible = True
Excel_Application.Worksheets.Add
Excel_Workbook.Worksheets(1).Name = "Summary"
....
Excel_Workbook.Worksheets(15).Name = "Scratch Pad1"
....
Excel_Workbook.Worksheets("Scratch Pad1").Delete
The above line causes excel to popup a msgbox requesting confirmation to
delete the sheet, This stops the automation. is it possible to get around
this by using sendkeys ?
Could it be similar to the following ?
With MailOutLook
.To = to_List
.Subject = "Weekly Status Report"
.Attachments.Add gg
.Body = "Please find attached the weekly report."
.Display
SendKeys "%{ENTER}", True