Location of Published Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

With Outlook 2003 I have two published forms. My goal is to have a command
button on one form which uses VBA code to open the other published form.

My problem is I don't know what path to use to point to the other published
form. Can someone point me in the right direction?

Thanks so much!
 
If it's already published just open it using the custom MessageClass.
 
You don't need a path for the form. To create a new instance of a custom form programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

If it's a message form, use the Drafts folder as the target. If the target is a default folder, you can use the Namespace.GetDefaultFolder method to return it as a MAPIFolder object. To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the MAPIFolder Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.

Note that code on Outlook custom forms is VBScript, not VBA.
 
I tried to figure out how to do this by looking up MessageClass, but all
variations of the code I wrote didn't work.

The form I open which has the command button is a Message Form and the
command button points to an Appointment form whose Message class is
"IPM.Appointment.IS Schedule Notification".

I just can't seem to format the code.
 
Hi Sue,

The form in question is an Appoinment form with a Message class of
"IPM.Appointment.IS Schedule Notification".

My original code is below and worked beautifully in Form Design when running
Forms, Run This Form. Once the form is published, it doesn't work because
I'm pointing to an .OFT file and not the Message class.

Sub CommandButton4_Click()

Set myItem = Application.CreateItemFromTemplate _
("C:\Documents and Settings\ldm\Application Data\Microsoft\Templates\IS
Schedule Notification.oft")

myItem.Display

dte = FormatDateTime(Item.UserProperties("Laptop Needed Date"), vbShortDate)
tme = FormatDateTime(Item.UserProperties("Laptop Needed Time"), vbShortTime)
myItem.Start = CDate(dte & " " & tme)

myItem.Send

End Sub
 
Yes, but since I'm limited to what I know, I couldn't figure out the
"targetFolder" part because when the form "IS Schedule Notification" opens,
the To: is completed with four different users.

This is what I tried to use, but the TargetFolder part wasn't working.
Set newItem = targetFolder.Items.Add("IPM.Appointment.IS Schedule
Notification")
 
Hi Sue,

I did read the 2nd part of your reponse, but I just couldn't figure it out.
So, what I did was write code to create a completed appointment as follows:

Sub CommandButton4_Click()

Const FormName = "IPM.Appointment"

Dim oItem
dte = FormatDateTime(Item.UserProperties("Laptop Needed Date"),
vbShortDate)
tme = FormatDateTime(Item.UserProperties("Laptop Needed Time"),
vbShortTime)

Set oItem = Application.ActiveExplorer.CurrentFolder.Items.Add(FormName)
oItem.Display

strSubject = "Setup Equipment"

Set myRecipient = oItem.Recipients.Add ("LDM")
oItem.Subject = strSubject
oItem.AllDayEvent = True
oItem.ReminderSet = True
oItem.ReminderMinutesBeforeStart = 180
oItem.Start = CDate(dte & " " & tme)

oItem.Send

End Sub

This works perfectly with one exception. What is the code for "Show time as
= Free".

Thanks,
LDMueller
 
What in particular was difficult for you to understand? Please remember that we don't know where (i.e. in what folder) you want to create the appointment. Only you know that. The code you have below would be fine to create an appointment in the currently displayed folder. The potential issue is: Is the current folder the correct calendar folder where you want to create a new appointment?

When in doubt about property names, check the object browser: Press ALt+F11 to open the VBA environment in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and their properties, methods, and events. Select any object or member, then press F1 to see its Help topic. In this case, you'll want to browse the properties for the AppointmentItem object. Also remember that VBScript supports only vb* constants. Others, e.g. ol* constants, must be either declared with Const declarations or used as literal values.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Hi Sue,

First of all, thank you for your response and in particular paragraph #2.
What is confusing to me is I don't want to create an appointment and put it
in other user's calendars. I want to use code to open and send a published
"appointment" form which will arrive in several users inbox where they will
have to accept them.
 
This means that (a) you need to create the appointment in your own calendar and (b) it needs to be not just an appointment but a meeting request.

We've already covered (a): The target folder is your own default Calendar folder. If the target is a default folder, you can use the Namespace.GetDefaultFolder method to return it as a MAPIFolder object.

For (b), see http://www.outlookcode.com/codedetail.aspx?id=88 and pay attention particularly to the use of the .MeetingStatus statement and those that follow it.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Back
Top