Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to add code programmatically to a macro for a button

hi,
i have coded the following lines, but i am not sure of how to insert
code within the macro Button_click. Also I am not sure of what
"Module1" is.
can someone help me please?
TIA!
Tina
================================================== ==========
For i = 0 To 4
ActiveSheet.Buttons.Add(50 + i * 100, 10, 80, 25).Select
Selection.OnAction = "Button_click"
Selection.Characters.Text = "Play Game" & i

Dim VBCodeMod As CodeModule
Dim LineNum As Long

Set VBCodeMod =
ThisWorkbook.VBProject.VBComponents_("Module1").Co deModule

With VBCodeMod
LineNum = .CountOfLines + 1

*** what do i write here to display a messagebox?
*** i want to add code to the Button_click macro.

End With
ActiveSheet.Range("A1").Select
Next i
Reply
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
Macro code behind button bcm2 Excel Worksheet Functions 1 January 13th 10 06:13 PM
Add a Button Programatically plus code jlclyde Excel Discussion (Misc queries) 1 December 9th 08 04:29 PM
VBA code for search button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 10:59 PM
configure add button & code [email protected] uk Excel Discussion (Misc queries) 7 November 24th 08 02:34 PM
code to reassign a macro to a toolbar button because of path change Almagg via OfficeKB.com Excel Discussion (Misc queries) 0 April 27th 07 06:42 PM


All times are GMT +1. The time now is 09:03 AM.

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

About Us

"It's about Microsoft Excel"