View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_2_] Dave Peterson[_2_] is offline
external usenet poster
 
Posts: 420
Default No characters data in Hyperlink cell

Excel won't allow you to do character by character formatting in formula cells
(or numeric cells).

On 08/17/2011 06:46, Walter Briscoe wrote:
I am using xl 2003.

I have some code, allowing me to compose a cell.
If I do something like cells(1,1) = cells(1,2)& cells(1,3),
character characteristice (Bold, Italic, etc) are not copied.
I follow up the assignment by reading the inputs and copying bold, etc
to the corresponding outputs.
This does not work where an input is of the form
'=hyperlink("http://www.google.com", "Hello, World!")' or with doubling
"=hyperlink(""http://www.google.com"",""Hello, World!"")"
I have code which checks that corresponding characters actually do
correspond.
It gets "Run-time error '1004': Unable to get the Text property of the
Characters class"
if I have run
Set Src = From.Characters(Start:=1, Length:=1)
Src appears in the Locals Window as

Expression Value Type
Src Characters/Characters
+ Application Application/Application
Caption<Unable ... class String
Count 1 Long
Creator xlCreatorCode xlCreator
+ Font Font/Font
+ Parent Object/Range
PhoneticCharacters "" String
Text<Unable ... class String

<Unable ... class is a shortened version of
<Unable to get the Caption property of the Characters class

I know bold characters can't be put in the value of a hyperlink.
If you select the "H" in the "Hello, World!" above, font details go
grey.

How do I recognise such situations in code?

Obviously, I can use On Error.
I can also test the input e.g. x.formula like "=HYPERLINK*"
I would prefer to have logic which as equivalent to recognising
"<Unable to get the Caption property of the Characters class"


--
Dave Peterson