LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default getting Runtime Error 1004

I've got the following code:

Sub CreateButton()
Dim btnMyButton As Button

Set btnMyButton = ActiveSheet.Buttons.Add(460, 75, 140, 30)

btnMyButton.Caption = "Delete and Update Charts and Lists"
btnMyButton.Select
Selection.OnAction = "btnDeleteAndUpdateSeatingChart"
Selection.Name = "btnDeleteAndUpdate"
End Sub

If I create a new workboox and then create a module with this sub in it and
then run it it works without error. However, when I run it from a second
workbook I get the error. In other words if I use the current workbook to
run vba script that copys the current worksheet to a new workbook and then
while that new workbook is active I run the above code it creates the button
on the new worksheet but when it tries to change the caption on the button
from "Button 1" to "Delete and Update Charts and Lists" I get Runtime Error
1004: Unable to update the Caption Property of the Button Class. Anyone have
any idea why this would be? I've tried saving the new workbook before
running the create button script and it had no impact on the problem. This
is in Excel 2007. Your help is greatly appreciated. Thanks!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
Runtime Error 1004??? kewlrunnings Excel Programming 5 October 25th 05 07:34 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Runtime error 1004 Gary[_4_] Excel Programming 1 October 10th 03 02:21 PM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"