Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Schedule a UserForm to open Automatically in Outlook

0

How do I use Application.OnTime to open a userform in Outlook?

Answer
Discuss

Answers

0
Selected Answer

Simple way is to call the macro that opens the form using a macro like this:

Private Sub Workbook_Open()

'Runs a macro at 4:30 PM
Application.OnTime TimeValue("16:30:00"), "Name_of_Macro"

End Sub

This macro goes into the ThisWorkbook module and runs when the workbook opens but you can just as easily put it into a regular module and call it from there.

The above macro is from our macro here.

Update

The internet says that OnTime won't work in Outlook:

"To simulate the OnTime Method, create a task with a reminder for the time you want the macro to run. Use a unique Subject string for the task. Hook the BeforeReminderShow Event and check for the unique string in the Subject that you specified when you created the task. If it's a match, run the macro you wanted to run at that time. Also, set Cancel = True so the reminder doesn't actually fire (it already did it's job so it doesn't need to actually fire)."

Discuss

Discussion

My userform is in Outlook so WorkBook_Open will not help.

thanks
OldCityCat (rep: 6) Dec 13, '17 at 6:04 am
My mistake, I didn't even notice that it was for Outlook. I updated the post with the code for Outlook. I haven't tested it but it should work.
don (rep: 1989) Dec 13, '17 at 7:36 am
Added code, closed Outlook, ReOpened 
Received Run-time error 438
"Object dosen't support this property or method"
Any suggestions?
FYI Running Outlook 2010
OldCityCat (rep: 6) Dec 13, '17 at 3:22 pm
So apparently Outlook doesn't work so much like Excel and it doesn't have OnTime. I rarely do anything in Outlook so this was news to me. Here is some information found while surfing the web and maybe it can help you make the macro that you need.

"To simulate the OnTime Method, create a task with a reminder for the time you want the macro to run. Use a unique Subject string for the task. Hook the BeforeReminderShow Event and check for the unique string in the Subject that you specified when you created the task. If it's a match, run the macro you wanted to run at that time. Also, set Cancel = True so the reminder doesn't actually fire (it already did it's job so it doesn't need to actually fire)."
don (rep: 1989) Dec 18, '17 at 5:56 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login