No characters data in Hyperlink cell

W

Walter Briscoe

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>"
 
D

Dave Peterson

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

Walter Briscoe

I am sorry to take so long to reply.

cell.formula <> "" seems to test for a formula cell.

I infer that a numeric cell has a restricted range of cell.NumberFormat.
cell.NumberFormat = "@" allows character manipulation.
cell.NumberFormat = "general" sometimes allows character manipulation.

From my perspective, cell.formula = "" is an immediately adequate
criterion. I would like a solid criterion.

I find the following inconsistent in the help for range.numberformat
"The format code is the same string as the Format Codes option in the
Format Cells dialog box. The Format function uses different format code
strings than do the NumberFormat and NumberFormatLocal properties."


In message <[email protected]> of Thu, 18 Aug 2011 06:34:01 in
microsoft.public.excel.programming, Dave Peterson
 
D

Dave Peterson

I don't have a guess.

Maybe you could share the exact code and what is in the value of the cells that
you're concatenating.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top