Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Syntax Problem : Grouping Buttons On A Multipage

Folkes,
These are my declarations...

Dim TempForm1
Dim Form1 As MultiPage
Dim ctrl As Control
Dim NextColl As Collection

Set TempForm1 = ThisWorkbook.VBProject.VBComponents.Add(3)
Set Form1 = TempForm1.designer.Controls.Add("forms.MultiPage.1 ")

.....on each of my multipage tabs I have a button with the name
"Next1","Next2" etc and it's these I want to group together so I can
write 1 sub for all the next buttons. This is the code I am trying to
use to group those buttons....

For Each ctrl In UserForm1.Controls
If Left(ctrl.Name, 4) = "Next" Then NextColl.Add Item:=ctrl
Next ctrl

....I have 2 problems.

1.) Initially I have to change UserForm1 to Userforms otherwise it
errors saying that the variable (UserForm1) is not declared. But when
it executes, it stops at this line with the error 'Object does not
support this property or method', so I debug it back to UserForm1 and
the for/next loop works...WHAT SHOULD THE FOR EACH LINE BE ?

2.) It loops the controls, find a "Next" but then won't add it to my
NextColl....WHAT SHOULD THIS LINE BE ? I think I'm missing a Set
NextColl=??????, am I ?

Thanks for any help you can give me.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Syntax Problem : Grouping Buttons On A Multipage

Problem 1 still stands....can anybody please help. Syntax for the ' FOR
EACH ' line.

Problem 2 solved by changing to ' Dim NextColl As New Collection '.

- Next Problem !....I can get my collection of commandbuttons
(NextColl), but how to reference it in the .CreateEventProc ?
.........The code below does not work.

With TempForm1.CodeModule
X = .CreateEventProc("Click", NextColl)
..InsertLines X + 1, "MultiPage1.Value = MultiPage1.Value + 1"
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Syntax Problem : Grouping Buttons On A Multipage

Morning Folkes.
Please can anybody give me some advise ?

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
Grouping Option Buttons ion a Group Box [email protected] New Users to Excel 5 October 15th 06 07:29 PM
Grouping buttons have desapeared ludo Excel Discussion (Misc queries) 1 June 20th 06 01:03 AM
grouping of option buttons mapi62 Excel Discussion (Misc queries) 0 February 22nd 05 12:19 PM
need help understanding syntax for adding a page to multipage GregJG[_11_] Excel Programming 9 July 10th 04 11:20 AM
Grouping Option Buttons m@_ Excel Programming 3 November 5th 03 02:20 AM


All times are GMT +1. The time now is 06:27 AM.

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"