ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   No characters data in Hyperlink cell (https://www.excelbanter.com/excel-programming/444873-no-characters-data-hyperlink-cell.html)

Walter Briscoe

No characters data in Hyperlink cell
 
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"
--
Walter Briscoe

Dave Peterson[_2_]

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

Walter Briscoe

No characters data in Hyperlink cell
 
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 of Thu, 18 Aug 2011 06:34:01 in
microsoft.public.excel.programming, Dave Peterson
writes
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"



--
Walter Briscoe

Dave Peterson[_2_]

No characters data in Hyperlink cell
 
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.

On 08/21/2011 10:47, Walter Briscoe wrote:
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 of Thu, 18 Aug 2011 06:34:01 in
microsoft.public.excel.programming, Dave Peterson
writes
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


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com