Outlook 2007 Calendar

Status
Not open for further replies.
In each If line, the last words are each a str field. So its the last field of each line. So if you look above, the If lines, you will see there is a title word, then the strFullName, and then another str field. So its the last field in each If line. As the strtext takes care of the StrFullName.
 
I do not think the table as different events have different fields re the particular contacts so the table is not the same size for each event.

So its also ok just to have the strtext set up as red and that means all is red. So just need to font all strFullName as blue
 
Ok.

Are you using olSelection.Find.Execute Replace:=wdReplaceAll in the last macro you tried? You need to loop - if : is found, all red, then move to check to blue. then go to the next line... it doesn't sound like its looping.
 
So how to do it please? Don't know what to add.
 
Update today ...just need to know what to do and then his is done
 
Thanks very much for your help. Any update tonight maybe?
 
At the end of this code:

selection.Find.ClearFormatting
With selection.Find
.Text = ":"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
selection.Find.Execute
selection.Find.Execute
selection.MoveRight Unit:=wdCharacter, Count:=3
selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
selection.Font.Name = "Times New Roman"
selection.Font.Size = 14
selection.Font.Color = wdColorRed

you need to do a replace all

olSelection.Find.Execute Replace:=wdReplaceAll
 
So add at the end of that code the two lines?




olSelection.Find.Execute Replace:=wdReplaceAll




But how can we font all Fullnames? That would be better please.




Thanks much
 
So what does this mean:




The only want to format the full names is to use something between the number and name that is searchable.
 
when you put the names and numbers together, you need to use a separator so you have something unique to search for - needs to be something not common, so comma won't do. : is used before the phone number, so it won't work, dash won't work because its used in phone #. ; might work, as long as its not used in the strings you create.
 
Please explain what and how I do it as I don't understand this at all
 
If you want to use different formatting for the names, you need to be able to search on a character so you can find the name.

Exactly how are the names listed in appointment body? Like this or something else?

Mobile Number: +1 (202) 555-1212 Mary Smith

Mobile Number: +1 (404) 555-1212 Bob Johnson

The layout above has nothing to search on to identify where last name starts.
 
So it looks like this if you selected multiple contacts?

Mobile Number: Mary Smith: 202.555.1212

Mobile Number: John Doe: 281.555.1212

Mobile Number: Sally Ann Johnson: 440.555.1212

And you want the name and number to use different colors and fonts?
 
Yes....actually the same Times New Roman, Size 14, and the Name will be Blue and underslined and the phone number will be red and underlined.....and all is Bold as well

But of course it is easier if the macro does it when I create the event, and not have to select the specific contacts in the Body of the Event,,,and if that's not available, I understand
 
This will do it - you need to make sure the line that 'writes' the name and address ends with a line feed - vbcrlf - because the pattern looks for that. The pattern will match any thing after the second colon so it will work with any phone number format.

test.png

This replaces the code below the itmAppt.Display line to the end sub.
Dim Reg1 As RegExp
Dim M1 As MatchCollection
Dim M As Match
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection
Dim strText As String
Dim strNumber As String
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
Set Reg1 = New RegExp
' \s* = invisible spaces
' \d* = match digits
' \w* = match alphanumeric
With Reg1
.Pattern = "(Mobile Number\s*[:]\s*([\w-\s]*)[:]\s*(.*)\n)"
.Global = True
End With
If Reg1.test(itmAppt.Body) Then
Set M1 = Reg1.Execute(itmAppt.Body)
For Each M In M1
' M.SubMatches(1) is the (\w*) in the pattern
' use M.SubMatches(2) for the second one if you have two (\w*)
Debug.Print M.SubMatches(1)
Debug.Print M.SubMatches(2)
strText = M.SubMatches(1)
strNumber = M.SubMatches(2)
olSelection.Find.ClearFormatting
olSelection.Find.Replacement.ClearFormatting
With olSelection.Find.Replacement.Font
.Size = 14
.Bold = True
.Underline = wdUnderlineSingle
.Color = wdColorRed
End With
With olSelection.Find
.Text = strText
.Replacement.Text = strText
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
olSelection.Find.Execute Replace:=wdReplaceAll
With olSelection.Find.Replacement.Font
.Size = 14
.Bold = True
.Underline = wdUnderlineSingle
.Color = wdColorBlue
End With
With olSelection.Find
.Text = strNumber
.Replacement.Text = strNumber
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
olSelection.Find.Execute Replace:=wdReplaceAll
Next
End If
Set olInspector = Nothing
Set olDocument = Nothing
Set olSelection = Nothing
Set objMsg = Nothing
Set ObjItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
 
I put it in and it did not work.....here is the line for the mobile number and not sure what to change and where:
If ObjItem.UserProperties("Phone 4 Selected") <> "" Then strDynamicDL3 = strDynamicDL3 & ("Mobile Number: ") & strFullName & (": ") & strMobileNumber & vbCrLf
 
Is part of the line changed?

Try changing this line

> Pattern = "(Mobile Number\s*[:]\s*([\w-\s]*)[:]\s*(.*)\n)"

to
.Pattern = "(Mobile Number:\s*(.*):\s*(.*)\n)"

Also, go to view menu, select immediate window - is listing the name or phone number? Do the names contain non-letters?
 
It does it...great!!! But, as you recall, I have a long list of other If lines, that have words and numbers coming from them....so what do i do for all the other fields that show up words and numbers....for example: here are two other If lines that show up words ...and is there a way to have the macro take care of all If lines...not just the mobile number?
If ObjItem.GetInspector.ModifiedFormPages("General").Controls("Company").Text <> "" Then strDynamicDL10 = strDynamicDL10 & ("Company Name: ") & strFullName & (": ") & strCompanyName & vbCrLf

If ObjItem.GetInspector.ModifiedFormPages("General").Controls("ComboBox9").Text <> "" Then strDynamicDL15 = strDynamicDL15 & ("Last Status: ") & strFullName & (": ") & strLastStatus & vbCrLf
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S outlook 2007 calendar search Using Outlook 6
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
R Outlook 2007 calendar colors Using Outlook 15
R Using Internet Calendar in Outlook 2007 within Citrix Using Outlook 1
F Outlook 2007 Calendar Appointments not in Outlook Today view Using Outlook 11
M calendar in outlook 2007 Using Outlook 1
M outlook 2007 calendar Using Outlook 2
J Outlook 2007 Error sharing Calendar: Error while preparing to send sharing message Using Outlook.com accounts in Outlook 2
P Outlook 2007 Calendar Ribbon has changed and I can't fix it Using Outlook 10
O Outlook Calendar 2007 - Invitation Times Using Outlook 19
K Outlook 2007 Calendar - Time spinner does not function correctly Using Outlook 1
V Setting up windows 7 & outlook 2007 w/ Iphone 4 & synch contacts & calendar Using Outlook 9
M sync Outlook 2007 calendar with icloud Using Outlook 1
B Outlook 2007 and Live Calendar Stopped Synching Using Outlook.com accounts in Outlook 4
A Change calendar permissions in Outlook 2007 Using Outlook 9
M Missing Calendar in Outlook 2007 Using Outlook 3
B cant accept iCal calendar invites in Outlook 2007 (SP3) Using Outlook 4
D Calendar Permissions Outlook 2003, 2007 and 2010 Exchange Server Administration 2
M Outlook 2007 Calendar Reminders Using Outlook 1
H Conflicts with other event in calendar ( outlook 2007 &amp; 2010) Using Outlook 0
P Outlook 2007 - Missing Calendar Item Using Outlook 4
P Outlook 2007 - Missing Calendar Item Using Outlook 1
D Outlook 2007 & 2010 calendar permissions Using Outlook 2
B Scheduling a Meeting Resource (Room) with a conflict doesn't indicate any conflict on users calendar in Outlook 2007 Using Outlook 1
P the outlook 2007 calendar cannot be saved because it was changed by another user or in another windo Using Outlook 4
G How re referance a non defualt outlook 2007 calendar Outlook VBA and Custom Forms 3
J Outlook 2007 hangs when Calendar tab is clicked Exchange Server Administration 49
S Not receving all email since converting from Outlook 2007 to Outlook Classic Using Outlook 3
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
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
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

Similar threads

Back
Top