How do I set the font of selected text in Outlook's HTML editor? I found a couple of answers on google, but none of them worked.
What version of Outlook are you using? In case of Outlook 2010 and up, Outlook always uses the Word editor and you can access it Application.ActiveExplorer.WordEditor, which returns an instance of the Word's Document object. Once you have it, you can use the Word object model to change the selected text attributes.
Related
I need to rollout an Outlook VBA macro to disable and display all hyperlinks in email messages.
Optimally all hyperlinks would be disabled from being clickable and for text that have a “hidden” link the link would be disabled and following the text (still in blue) the link would be displayed within square brackets.
I have a lot of Excel VBA experience but almost no Outlook VBA experience. I’m surprised this code isn’t all over the place but after a week of searching I’ve found nothing.
You would need to retrieve the HTML body (MailItem.HTMLBody property), load it into an instance of the IHTMLDocument2 object, loop thorough the links collection and modify the links. You will then need to retrieve the modified HTML body and set the MailItem.HTMLBody property.
You can of course do your own parsing by looking at all the <a> tags in the HTML body instead of using the IHTMLDocument2 object.
I need a macro for Outlook 2016 that can change a selection to: font = Times New Roman, Size = 12 and Italic.
I created a macro on the fly in an older version of Outlook that worked fine. I also created one that "undid" what I had done.
I also created a macro on the fly in Word 2016 for doing the above. I tried pasting it into Outlook. I also tried editing it with guesses. Nothing worked.
Don't have any current code.
Verdana 10 normal text should change to Times New Roman 12 italic.
There are three main ways for working with bodies in Outlook:
Body.
HTMLBody.
The Inspector class provides the WordEditor property which returns an instance of the Document class from the Word object model which represents the message body. Outlook uses Word as an email editor. So, you can use the Word object model to deal with the message body in Outlook.
You can read more about that in the Chapter 17: Working with Item Bodies .
Microsoft Word 2010
I am trying to find the imageMso for Word inside of Word 2010. Word has all the other Office products icons listed in WordControls.xlsx, but apparently not itself. I need it for a group image in my Word ribbon tab.
For the moment, I grabbed a copy of the one displayed in explorer.
CustomUI does provide images for most of the other Office applications, and even includes an icon for FoxPro, but it doesn't include images for Word or Visio.
And, no amount of poking around for an undocumented imageMso seems to work...
Subject to licence terms, you could try the new Fabric icons provided by Microsoft, but you'd have to embed the images and do your own image replacement if you wanted to reflect the right icon version for each version of Word.
Is there any possibility to see doc variables? It's Microsoft Word 2003, I have added a doc variable in a document, but if I take a look at the document I can't see there any variables. Is it possible to turn document variables visible?
I solved it myself. To change fields visible mode you should use ALT+F9
There seem to be a bunch of things in the Word 2007/2010 VBA object model which are simply missing in Word 2011 VBA.
Specifically, Word 2007 (for Windows) includes objects and methods related to:
ContentControls
CustomXMLParts
OpenXML
For example:
**Word.Document**
Property ContentControls As ContentControls
contentcontrol events eg Event ContentControlAfterAdd(NewContentControl As ContentControl, InUndoRedo As Boolean)
Property CustomXMLParts As CustomXMLParts
Property WordOpenXML As String
**Word.ContentControl**
Property XMLMapping As XMLMapping
**Word.ContentControls**
Function Add([Type As WdContentControlType = wdContentControlRichText], [Range]) As ContentControl
**Word.Selection/Word.Range**
Sub InsertXML(XML As String, [Transform])
In the VBA editor in Word 2011, I can't find any of these.
Are the differences between Word 2011 VBA and Word 2010 VBA object models documented anywhere?
I've also browsed/searched the Script Editor's dictionary, to see whether any of these objects are exposed there. They aren't.
In my experiments so far, Word 2011 does preserve existing content controls in a docx (ie it saves them), but you can't see them on the document surface in the UI, and there doesn't seem to be any way to add new ones (either via the Developer tab, or via VBA or AppleScript).
So, any suggestions as to how to work with around gaps in the Word for Mac 2011 VBA object model generally, and in particular how to work with content controls and custom xml in Word on the Mac?
Unfortunately it appears that CC work in VBA has been removed from Mac Word 2011 VBA. See this page:
Object Model Changes from Microsoft Word 2010
The full online help for Mac Word 2011 VBA is at: http://mac2.microsoft.com/vb/1033/default.aspx?src=wd