Help with this code

G

Guest

I have been trying most of the day to get this to work. Sue turned me in one direction wich was helpful but I am still having problems. This code runs but never populates the to subject and body fields, but I get no errors. Help please would be great. I think that I have posted more detail then what I have in the past
Sub testdatebox(
Dim objnewmsg As Objec
Set objnewmsg = Application.CreateItem(olMailItem

With objnewms
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=
Visible = Tru
.To = "(e-mail address removed)
.Subject = "Confrence Room Request Please
.Body = "line2
End Wit

End Su

Thank
GM I really need this to work......pleas
 
S

Sue Mosher [MVP-Outlook]

Unless you add a statement to save or display the message, how would you
know whether the code is populating those fields?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



I have been trying most of the day to get this to work. Sue turned me in one
direction wich was helpful but I am still having problems. This code runs
but never populates the to subject and body fields, but I get no errors.
Help please would be great. I think that I have posted more detail then what
I have in the past.
Sub testdatebox()
Dim objnewmsg As Object
Set objnewmsg = Application.CreateItem(olMailItem)

With objnewmsg
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=2
Visible = True
.To = "(e-mail address removed)"
.Subject = "Confrence Room Request Please"
.Body = "line2"
End With

End Sub


Thanks
GM I really need this to work......please
 
R

Rob F

Try:

Dim myOlApp As Outlook.Application
Dim objnewmsg As Object

Set myOlApp = CreateObject("Outlook.Application")
Set objnewmsg = myOlApp.CreateItem(olMailItem)

With ....

Works for me (no credit to me for the code, though!)

Rob
 

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