Outlook 2007 Code for Note Fields of Appointment

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
I have a contact form with the script that creates a calendar event for the contact I open and uses the fields of the contact re dates and subjects and locations and adds them to the appointment ....

I learned to add to the script code, a line that will put in the note field of the appointment, the phone numbers of the contact ....and I have title before each phone number....so all i need to do, is have the second phone number and related title be below the first phone number and title, so its two lines, not just one line....so here is the code line that takes care of the note field, but need to put something in so it makes it two lines in the note field of the appointment.

itmAppt.Body = "Mobile Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone4").text & " " & "Business Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone1").text
 
Try vbcrlf or vbcr -

itmAppt.Body = "Mobile Number" & " - " & item.getinspector.modifiedformpages("General").con trols("Phone4").text & vbcrlf & "Business Number" & " - " & item.getinspector.modifiedformpages("General").con trols("Phone1").text

As an FYI, you can use the chr code too -

Chr(10) or vbLf = Line Feed Return

(Chr(13) or vbCr Carriage Return

vbCr Lf = Carriage return line feed.
 
What you first showed did it right away...thanks so much...and I assume if I wanted to line spaces, just repeat that...correct?
 
And forgot to ask...if any phone area in the contact does not have phone number is there a way adjust the code so I does not to display the title name as there is not phone number??
 
you put it at the end of the line where you want to break - use & vbcrlf & - just like you would if you were using a space.

If you use chr, it's done the same way - put & chr(13) & where you want the break.
 
and if any phone area in the contact does not have phone number is there a way adjust the code so it does not to display the title name as there is not phone number??


 
Yes, repeat the line break for additional line

& vbcrlf & vbcrlf &

And forgot to ask...if any phone area in the contact does not have phone number is there a way adjust the code so I does not to display the title name as there is not phone number??

You can use an if statement - it can sometimes be goofy if the field had a number then you removed it.

if item.getinspector.modifiedformpages("General").con trols("Phone4").text <> then
"Mobile Number" & " - " & item.getinspector.modifiedformpages("General").con trols("Phone4").text & vbcrlf

end if

if item.getinspector.modifiedformpages("General").con trols("Phone1").text <> then
"Business Number" & " - " & item.getinspector.modifiedformpages("General").con trols("Phone1").text & vbcrlf

end if
 
So I replace the code line I have with these two lines??
 
I replaced my line with you lines, and the error is "syntax error" as to the if statement
 
oh, i wonder if its the greater and less than signs - i used html code because the forum software hides the characters but i see now that it didn't convert the code.
 
You need to check the field to see if its empty and I think an if statement would be the easiest way to do this.
 
So what exactly do put in and do i take out the code i showed you? So please show me the details of what it is and I will test it.
 
this *should* work -

if item.getinspector.modifiedformpages("General").controls("Phone4").text <> then
"Mobile Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone4").text & vbcrlf
end if
if item.getinspector.modifiedformpages("General").controls("Phone1").text <> then
"Business Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone1").text & vbcrlf
end if
 
So do I keep in the code line I showed you or delete it?
 
I'm not sure what you mean - i only see the one with the mobile and business number fields.
 
The one you see that I showed do i replace it with your lines or add your lines before or after it?
 
You'll replace the lines.
 
I did it, but it is still the same error.....and below is the full code that maybe will to understand what to change:

Sub btnAddCalendarEvent_Click

dim ContactName

dim olns

dim MyFolder

dim NumItems

dim myItems

Dim StartDateTime

Dim EndDateTime

Dim ShowAs

Dim itmAppt

ContactName = Item.GetInspector.ModifiedFormPages("General").Controls("Fullname").value

Set olns = Item.Application.GetNameSpace("MAPI")

Set myfolder = Session.GetDefaultFolder(9).Folders(2)

Set itmAppt = myfolder.Items.Add("IPM.Appointment.Office Calendar Event")

itmAppt.Subject = ContactName & " - " & item.getinspector.modifiedformpages("General").controls("combobox11").text

itmAppt.Location = item.getinspector.modifiedformpages("General").controls("combobox12").text
itmAppt.Body = "Mobile Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone4").text & vbcrlf & "Business Number" & " - " & item.getinspector.modifiedformpages("General").controls("Phone1").text





StartDateTime = item.getinspector.modifiedformpages("General").controls("OlkDateControl1").value & " " & item.getinspector.modifiedformpages("General").controls("OlkTimeControl1").text



itmAppt.Start = StartDateTime

EndDateTime = item.getinspector.modifiedformpages("General").controls("OlkDateControl2").value & " " & item.getinspector.modifiedformpages("General").controls("OlkTimeControl2").text



itmAppt.End = EndDateTime

ShowAs = item.getinspector.modifiedformpages("General").controls("combobox13").value

Select case Showas

case "Free"

ShowAs = 0

Case "Tentative"

ShowAs = 1

Case "Busy"

ShowAs = 2

Case "Out of Office"

ShowAs = 3

End Select

itmAppt.BusyStatus = ShowAs



itmAppt.links.add item

itmappt.display

End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Outlook 2007 Contact Form Code Not Working Using Outlook 20
M Updating VBA code from outlook 2007 to outlook 2010 Using Outlook 1
K Outlook 2007 Error Code 0x80040607 Using Outlook 10
D Outlook 2007 Recovering E-Mails Using Outlook 0
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3
icacream From Outlook 2007 to 2016 ! Using Outlook 9
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S Outlook 2007: Address Cards allow entering text! Why? Using Outlook 3
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
C Move from Outlook 2007 Enterprise (MOE) to Outlook Pro plus 2007 Using Outlook 1
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
P outlook addin unloaded in office 2007 Using Outlook 0
B Fonts in Outlook 2007 Using Outlook 4
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
C out of space in file group Outlook 2007 Using Outlook 2
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
P Outlook 2007 Email Categorization using VBA Outlook VBA and Custom Forms 1
M Unable to Configure Gmail Account in Outlook 2007 Using Outlook 1
R Outlook 2007 or 2010 - Lock Down Functionality Outlook VBA and Custom Forms 3
S Outlook 2007, windows 10 Font size Using Outlook 1
Diane Poremsky Manually create a POP3 account in Outlook 2007 Using Outlook 0
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
L Outlook 2007 Font Using Outlook 3
J Outlook 2007 connector and Windows 10 Using Outlook 3

Similar threads

Back
Top