LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel crashes with createEventProc for a button

What version of excel are you using?

--
Regards,
Tom Ogilvy

"Tina" wrote in message
om...
Hi,
I am running the following code and Excel crashes after making the
first or the second button. It also opens the code window that i dont
want it to show. What should i do? Why is excel crashing?
-----------------------

Workbooks("Game").Sheets("Data").Activate
Dim OLEObj As OLEObject
For i = 0 To 4
Set OLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Forms.Comma ndButton.1",
Link:=False _
, DisplayAsIcon:=False, Left:=50 + i * 100, Top:=10,
Width:=80, Height:= _
25)
OLEObj.name = "TheButton" & i
'
' Create the event procedure
'
With

ActiveWorkbook.VBProject.VBComponents(OLEObj.Paren t.CodeName).CodeModule

.InsertLines .CreateEventProc("Click", OLEObj.name) + 1,
"Msgbox ""You Clicked The Button"" "

End With

Next i
----------------
TIA!
Tina



 
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
Excel crashes bigfile Setting up and Configuration of Excel 2 July 27th 09 04:07 PM
Excel 2007 Crashes Whenever Add-In Button is Clicked Richard S Setting up and Configuration of Excel 0 August 28th 07 12:50 AM
excel crashes Matt Excel Discussion (Misc queries) 0 April 20th 07 07:52 PM
Excel XP Crashes Jeff Pines Excel Discussion (Misc queries) 6 February 14th 06 05:50 PM
Excel Crashes Hezingen Excel Discussion (Misc queries) 0 December 5th 05 03:47 PM


All times are GMT +1. The time now is 09:15 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"