Solved Outlook Automation and Task Scheduler (1 Viewer)

ajb_1976

Registered User.
Local time
Today, 07:53
Joined
Feb 25, 2005
Messages
34
Hello, I have an issue with the sending of emails via an access db and the task scheduler. I have set up a macro that calls several functions in order, the purpose of these functions is to send follow up emails to clients based on their entry date to my CRM. When working in the database directly, firing this macro works perfectly and all emails get sent (via outlook). My problem starts when I use the task scheduler to automate this. I have created a .bat file that loads access and fires the macro, this works via the scheduler but only the 1st email gets sent as the database then hangs, awaiting a user input -
1708430423388.png

As soon as this pop is clicked the macro continues (it has to be clicked for every email in the recordset)
My question is - is there a way to automatically respond to this popup? or pass the focus to microsoft outlook as I assume that will work also.
Environment: Server 2012 R2
Access 2013
Outlook 2023

Many thanks
Alan
 

ajb_1976

Registered User.
Local time
Today, 07:53
Joined
Feb 25, 2005
Messages
34
just an update, as is always the case after spending hours trying to make something work, the moment you post for help you solve it! just in case anyone has anything similar i resolved it by adding the following into my modules -

At the top of my module I added:
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long

In the email section of the code I added:
Call SetForegroundWindow(Application.hWndAccessApp)

This appears to keep the database in the foreground and happily loops through the code
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:53
Joined
Sep 21, 2011
Messages
14,448
Outlook Automation and Task Scheduler are indispensable tools that streamline productivity and optimize workflow management for individuals and organizations alike. Outlook Automation refers to the process of automating repetitive tasks within Microsoft Outlook, leveraging its robust features to save time and effort. This includes automatically sending emails, creating calendar events, organizing messages into folders, and performing other routine actions.

Task Scheduler, on the other hand, is a built-in Windows utility that allows users to schedule tasks to run automatically at predefined times or in response to specific events. By integrating Outlook Automation with Task Scheduler, users can create powerful automated workflows tailored to their needs. For example, they can schedule Outlook to send recurring emails to clients, generate daily reports, or remind team members of upcoming deadlines.

The synergy between Outlook Automation and Task Scheduler offers numerous benefits, including increased efficiency, reduced manual errors, and improved time management. It allows individuals to focus on more strategic tasks while mundane activities are handled seamlessly in the background.

Moreover, this combination enables organizations to standardize processes, ensure consistency across teams, and enhance overall productivity. By harnessing the power of automation, businesses can allocate resources more effectively and achieve their goals with greater efficiency.

In conclusion, Outlook Automation and Task Scheduler represent a dynamic duo in the realm of productivity tools, empowering users to automate repetitive tasks and optimize their workflow management for enhanced efficiency and success.
ChatGPT ?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:53
Joined
Feb 28, 2001
Messages
27,321
Post from fountainhead2313 was determined to be SPAM and has been removed. By direction of site owner, that member has been banned.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:53
Joined
Feb 28, 2001
Messages
27,321
just an update, as is always the case after spending hours trying to make something work, the moment you post for help you solve it! just in case anyone has anything similar i resolved it by adding the following into my modules -

At the top of my module I added:
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long

In the email section of the code I added:
Call SetForegroundWindow(Application.hWndAccessApp)

This appears to keep the database in the foreground and happily loops through the code

Thanks! First, it is really good that you solved your problem. Second, it is GREAT that you posted the solution.
(y)
 

Users who are viewing this thread

Top Bottom