View Single Post
 
Old 03-15-2018, 09:25 PM
Peterson Peterson is offline Windows 7 64bit Office 2016
Competent Performer
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default VBA: how to get just header text, without formatting codes

I am trying to get the text from the LeftHeader, using the following code:

Code:
Sub Header() 

MyLeftHeader = ActiveSheet.PageSetup.LeftHeader
Debug.Print MyLeftHeader 

End Sub
Trouble is, in addition to the text, I end up with all of the formatting codes, as follows, for example:
&"Arial,Bold"&12Hello World.
Is there a way to get just the text, without the codes, as if I were to click into the header, select the text, and copy it?

I already have a macro to strip out the codes, so I don't need another -- I'm just wondering if there's a simpler way to get the text.
Reply With Quote