Button Text Problem

A

AndyM

I Have recently installed Excel 2007 and some code that worked on previous
versions now does not work.

I am trying to create a button with 3 lines of text using the following code:

ActiveSheet.Buttons.Add(23.25, 17.25, 209.25, 87).Select
Selection.Characters.Text = "CALCULATE:" & Chr(10) & "Calcultation Step
1" & Chr(10) & "Calculation Step 2"


In previous versions of Excel this code would give me a button with 3
lines:

CALCULATE
Calculation Step 1
Calculation Step 2


In 2007 version all i get is an error message saying
"Run-time error '1004'

Can anyone explain why or suggest a way to create a button that will start a
new macro?


Thanks
 
J

Jim Cone

Maybe Excel was "improved" again?
I don't use XL2007. However, try using a shape instead of button...
'--
With ActiveSheet.Shapes.AddFormControl(xlButtonControl, 23.25, 17.25, 209.25, 87)
With .TextFrame.Characters
.Text = "CALCULATE:" & Chr(10) & _
"Calculation Step 1" & Chr(10) & "Calculation Step 2"
.Font.Size = 12
End With
End With
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





"AndyM"
<[email protected]>
wrote in message
I Have recently installed Excel 2007 and some code that worked on previous
versions now does not work.
I am trying to create a button with 3 lines of text using the following code:

ActiveSheet.Buttons.Add(23.25, 17.25, 209.25, 87).Select
Selection.Characters.Text = "CALCULATE:" & Chr(10) & "Calcultation Step
1" & Chr(10) & "Calculation Step 2"

In previous versions of Excel this code would give me a button with 3 lines:
CALCULATE
Calculation Step 1
Calculation Step 2
In 2007 version all i get is an error message saying "Run-time error '1004'
Can anyone explain why or suggest a way to create a button that will start a
new macro?
Thanks
 

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