Use VBA editor on my custom OL form

  • Thread starter cmonroe21 via OfficeKB.com
  • Start date
C

cmonroe21 via OfficeKB.com

I have been able to create fairly extensive custom forms using no code at all.
.. Outlook seems to be pretty custom form friendly. But now I am trying to
create a task form and don't think I can get around creating a "Send" button
on my custom form without code. Sounds easy enough, but I am confused with
the VBA editor... how do I add my already created custom OL2007 form to the
project to edit it? I can create a new completely blank form that is not
associated with the proper OL form, but that doesn't help me. The book goes
over how to create a new form in the VBA editor, and also goes over how to
design an Outlook Template via "Design a Form," but how do I design a pre-
existing template AND use the VBA editor to modify it? Or is the VBA editor
unusable on the Outlook Items in the Standard Forms Library? It's such a
basic fundamental that I hope I am not confusing anyone...
 
S

Sue Mosher [MVP]

VBA has nothing to do with code behind an Outlook form, which is VBScript,
not VBA. Use the View Code command in the form designer to display the code
window.
 
C

cmonroe21 via OfficeKB.com

Thank you! So when I create the "Send" command button control on the form,
OL2007 doesn't automatically create a Sub Send_Click()? (The view code
window is empty, so I'm guessing not?) So I have to create it? And when I
do, do I have to create any dim's? (Like for the namespace or item or
anything?) Or are they already created? And the method I want to call
inside the Sub Send_Click() is objItem.Send? (If objItem is already
automatically created, that is?) Thank you so much for the help!
VBA has nothing to do with code behind an Outlook form, which is VBScript,
not VBA. Use the View Code command in the form designer to display the code
window.
I have been able to create fairly extensive custom forms using no code at
all.
[quoted text clipped - 14 lines]
unusable on the Outlook Items in the Standard Forms Library? It's such a
basic fundamental that I hope I am not confusing anyone...
 
C

cmonroe21 via OfficeKB.com

Sub Send_Click()
Dim myTask As Outlook.TaskItem 'do I need to do this? or is the task
item already created and already have a name?
Set myTask = Application.CreateItem(olTaskItem) 'but I want to use my
custom Task, not the standard OL task??
myTask.Send 'this is essentially the only line I need, if I knew the
name that OL automatically assigns my custom Task form Item?
End Sub

Also, I have the Assign To: command button and text box on my form, and
they're linked to the proper fields and working, so I won't need to assign a
recipient in the code, will I?


VBA has nothing to do with code behind an Outlook form, which is VBScript,
not VBA. Use the View Code command in the form designer to display the code
window.
I have been able to create fairly extensive custom forms using no code at
all.
[quoted text clipped - 14 lines]
unusable on the Outlook Items in the Standard Forms Library? It's such a
basic fundamental that I hope I am not confusing anyone...
 
C

cmonroe21 via OfficeKB.com

I used:

Sub Send_Click()
Item.Assign
Item.Send
End Sub

And it seems to like it, but it says I cannot send a task request to myself??
I tried sending it to someone else, and I cannot be sure they got it at the
moment, but it is now in my Sent Items folder (good?!) Can I sidestep the
inability to send a task request to myself? (For testing purposes?)

VBA has nothing to do with code behind an Outlook form, which is VBScript,
not VBA. Use the View Code command in the form designer to display the code
window.
I have been able to create fairly extensive custom forms using no code at
all.
[quoted text clipped - 14 lines]
unusable on the Outlook Items in the Standard Forms Library? It's such a
basic fundamental that I hope I am not confusing anyone...
 
S

Sue Mosher [MVP]

You need to type in any Click event handlers that your form needs. Form
script supports two intrinsic objects -- Application for the currently
running Outlook.Application object and Item for the item where the code is
running.
 
S

Sue Mosher [MVP]

No, as the error message said, you can't send a task request to yourself.
 
C

cmonroe21 via OfficeKB.com

Thank you so much for your help! It's working like a charm! :)
No, as the error message said, you can't send a task request to yourself.
[quoted text clipped - 9 lines]
moment, but it is now in my Sent Items folder (good?!) Can I sidestep the
inability to send a task request to myself? (For testing purposes?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top