Outlook 2007 Calendar

Status
Not open for further replies.
Update? as what we fix re fonting all from a field I think will apply to all other fields I use in this area
 
No error. I selected two contacts and the fullname of both contacts are fonted but only the mobile number of one of them is fonted. I do F8 in the macro and if so, what do i fix?
 
This calender event is for multiple contacts selected. So how do we have all from a field be fonted and not just the last one which is what happens with the mobile number. And when I did in another field, the same result from only the last contact.

So can this be updated maybe as the fields are all strings.
 
you'd have to format the text before you create the string and move to the next contact. In email, you could use HTML tags but that doesn't work for appointments. You'll need to find the test after its added to the body - maybe using regex and searching for : - just don't use colon's in the rest of the body.

http://slipstick.com/developer/regex-parse-message-text/
 
Thanks much. However I still don't understand a lot of technical areas. Can you maybe show me what to put in the macro and where and I can try it?
 
try the section of code below, replacing the code from itemappt.display to the end. The pattern finds everything on a line following :
With Reg1
.Pattern = "([:]\s*(.*)\s*)\n"
.Global = True
End With

while this pattern does only the names in my sample code. (I had to remove a bunch of stuff from your code to test since I don't have the custom forms.)
With Reg1
.Pattern = "([:]\s*([\w-\s]*)\s*)\n"
.Global = True
End With

------------------------
itmAppt.Display

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
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 = "([:]\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)
strText = M.SubMatches(1)
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

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
 
So do i change the pattern to a different words as the specific strMobileName and later it refers to text and what to change there? Then i wii try it and tell what it does
 
Here is what I think the problem is that needs to be adjusted...

I added to the code another field which is the CompanyName....so i created strCompanyName = ObjItem.GetInspector.ModifiedFormPages("General").Controls("Company") and copied the code re the font and put in strCompanyName and it fonts all Company Names from the selected contacts....so I think the problem is that the MobileNumber field since it is numbers and not text...that is the problem for fonting all......so what do you think we should do for the font of phone numbers?
 
What I said above in incorrect as in my test contacts i use for the code, the company name and full name are the same in each.contact...and when they are different, it only fonts one....

So what you gave me to put after Display did not work ..and there was an error
 
The error is as to :

Dim Reg1 As RegExpDim M1 As MatchCollection

Dim M As Match

New RegExp

The errors are: User-defined type not defined
 
This pattern will apply to numbers and letters and other characters, between the : and end of line (\n tells the code 'end of line').




With Reg1
.Pattern = "([:]\s*(.*)\s*)\n"
.Global = True
End With




That will format a line something like this;


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


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






if you only want the number and not the name following, you need a different pattern. You'll need to use a unique character at the end of the number, one that won't be found in the number (so dash is out), something like this...




if you use Mobile number: +1 (202) 555-1212 ; Bob Johnson format




This should apply only to the number, not the name



.Pattern = "(Mobile number[:]\s*(.*)\s*) ;"




only the content between the "Mobile number:" and ";" will be changed.
 
I did the Microsoft VBScript Regular Expressions 5.5 library and all words and numbers from all fields are the same font......If I want FullName to be a different color, what do I add, and then this is done, because all fields are that are at the end of each line, should be the same, but the FullName field before each ending field needs to be a different color.....Blue.....and then his is perfect and done!!
 
Below is the four lines (and there will be others later) where each strDynamicDL(2), strDynamicDL(3), strDynamicDL(10), strDynamicDL(15) then shows up in the Body....and the line of each strDynamicDL in the order of the title number, which is fonted differently, and then the strFullName, which is the full name of each contact, and then, the words or phone number from the specific fields....so I want the strFullName to be the same side and type of font of the other fields, but strFullName needs to be Blue and the others fields are Red.

strDynamicDL2 = strDynamicDL2 & ("Full Name/NickName: ") & strFullName & (": ") & ObjItem.GetInspector.ModifiedFormPages("General").Controls("TextBox10").Text & vbCrLf


If ObjItem.UserProperties("Phone 4 Selected") <> "" Then strDynamicDL3 = strDynamicDL3 & ("Mobile Number: ") & strFullName & (": ") & strMobileNumber & vbCrLf


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
 
I set the initial font to Blue so the FullName field words are blue...and as the code line shows above, after the strFullName, there is a ": ", and then the words or phone numbers...so I found out under Word document and moved it in that it identifies the ": " twice from the beginning and then moves over to the words of the field and fonts them, but I would have to keep doing it for all fields not just one of them....so her is the code that does it, and is there a way that it applies to all lines?

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
 
I wonder if it would be easier/ better to format your data as a table?

This is the code word creates for tables - the cell values ("Cell1" etc) can be replaced with variables from outlook.
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
.ApplyStyleRowBands = True
.ApplyStyleColumnBands = False
End With
Selection.TypeText Text:="cell1"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="cell2"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="row2cell1"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="row2cell2"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="more"
Selection.MoveRight Unit:=wdCell
 
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