ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to check for Bolded character is a text Box? (https://www.excelbanter.com/excel-programming/333606-how-check-bolded-character-text-box.html)

Laguna

How to check for Bolded character is a text Box?
 
I face a problem in detecting bold data in a shape

ActiveSheet.Shapes("Text Box 17").Select
MsgBox Selection.Characters(Start:=i, Length:=1).Font.FontStyle

when i use this similiar code to detect bolded character in a cell, it works
fine.
but when i use this code to detect bolded data in a text box or rectangle
shape
the error " invalid use of null message" appear

how to check bolded data in a shape in Excel 2000

keepITcool

How to check for Bolded character is a text Box?
 

normally you'll get the null if you want to return a property
for multiple characters with different formatting.

but as you found within textframes the Fontstyle seems buggy.
However the Bold/Italic etc properties work correctly

Sub foo()
Dim o As Object, f As Font
Set o = Sheet1.Shapes(1).TextFrame
Set f = o.Characters(1, 1).Font
Msgbox f.Bold & vblf & f.Italic

End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Laguna wrote :

I face a problem in detecting bold data in a shape

ActiveSheet.Shapes("Text Box 17").Select
MsgBox Selection.Characters(Start:=i, Length:=1).Font.FontStyle

when i use this similiar code to detect bolded character in a cell,
it works fine.
but when i use this code to detect bolded data in a text box or
rectangle shape
the error " invalid use of null message" appear

how to check bolded data in a shape in Excel 2000



All times are GMT +1. The time now is 05:27 PM.

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