View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Pat D[_2_] Pat D[_2_] is offline
external usenet poster
 
Posts: 6
Default how can I work with worksheet textboxes in VBA?

Thanks!

"Ken Johnson" wrote:

On Mar 20, 10:46 pm, Pat D <Pat wrote:
I have several textboxes on an Excel worksheet. Is there a way to access
(change contents, formatting,...) these textboxes from within my VBA code?


Text boxes are Shape objects.

Examples:
ActiveSheet.Shapes("Text Box 1").TextFrame.Characters.Text =
ActiveSheet.Shapes("Text Box 1").TextFrame.Characters.Text & Chr(10) &
"That's all folks."

Adds a new line and "That's all folk." to Text Box 1

ActiveSheet.Shapes("Text Box 1").TextFrame.Characters(20,
25).Font.Bold = True

Makes 25 characters, starting at the 20th character, Bold.

Ken Johnson