Need to invoke sub in VBAProject.OTM from VBScript
I have a custom Outlook form that needs to pull data from my Outlook database generally to populate itself and, launch additional forms, depending on the data that comes back. I've written the subroutines that do all the work in VBA and those now reside in the Outlook Macro file (VBAProject.OTM). I want to be able to invoke the triggering code from within the custom form by clicking on a Command Button on the form. It is my understanding that the only place in which I can write my event handler for the Command Button is in the VB Scripting window available through the "View Code" menu item when in Form Design Mode in Outlook's Developer tab.
I need the syntax for calling subroutines or functions in the VBAProject.OTM from the form's VBScript window.
I appreciate the guidance.
Re: Need to invoke sub in VBAProject.OTM from VBScript
Re: Need to invoke sub in VBAProject.OTM from VBScript
i have not tested, but you could set up a reminder item by code from vbs, which can fire the application_reminder event, from where you can call whatever other procedures you want, including to delete the item when finished
Code:
Set app = CreateoObject("Outlook.Application")
Set t = app.CreateItem(3)
t.ReminderOverrideDefault = True
t.ReminderTime = Now + TimeSerial(0, 0, 1)
t.ReminderSet = True
t.subject = "temp"
t.Save
Code:
Private Sub Application_Reminder(ByVal item As Object)
MsgBox "Yes3" ' do whatever
item.Delete
End Sub
partially tested