Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


I have a form that when opens has a button attached, tht when pressed
executes a sub that makes changes on the frm.

I would like to get rid of the button and have the sub auto execute
when the form opens. ive tries linking the sub to form initilize but no
joy

any ideas


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default On Form Start Up

Hi Ceemo,

Move the button code into the userform's initialze event, i.e.:

Private Sub UserForm_Initialize()

'Your button code

End Sub


---
Regards,
Norman



"ceemo" wrote in
message ...

I have a form that when opens has a button attached, tht when pressed
executes a sub that makes changes on the frm.

I would like to get rid of the button and have the sub auto execute
when the form opens. ive tries linking the sub to form initilize but no
joy

any ideas


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:
http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default On Form Start Up

Sure!
When in the workbook do go here
Visual Basics
view
project explorer
this workbook
'now a code window is on the screen
go to the down arrow in the box that reads (general)
select workbook
go to the next window to the right and select
open ( you may already be on open)
the code screen now reads:
Private Sub Workbook_Open()
'your code(macro) goes in here
End Sub
have fun

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default On Form Start Up

Hi DA,

I think that the OP refers to the form's initialisation, not the opening of
the workbook:

I would like to get rid of the button and have the sub auto execute
when the form opens.


---
Regards,
Norman



"damorrison" wrote in message
oups.com...
Sure!
When in the workbook do go here
Visual Basics
view
project explorer
this workbook
'now a code window is on the screen
go to the down arrow in the box that reads (general)
select workbook
go to the next window to the right and select
open ( you may already be on open)
the code screen now reads:
Private Sub Workbook_Open()
'your code(macro) goes in here
End Sub
have fun



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


ive attached my book to help expain why i cant just paste the code tha
the button is linked to into the initalise window

using some progress code i found (you may reconise) im amending it so
can run it without having to press the button on the form. so it wil
just run when opened until 100% the auto clos

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=48243



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default On Form Start Up

Oh Yeh!
I better go to bed!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


missed it here it i

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=48243

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


b**locks cant get it to attach oh well


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default On Form Start Up

Hi Ceemo,

Very properly, few in this NG would be prepared to open unknown attachments.

Try instead explaining the intrinsic problem and, if necessary, post the
button code.

---
Regards,
Norman


"ceemo" wrote in
message ...

missed it here it is


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:
http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


Private Sub UserForm_Initialize()

' ProgressBar1
labPg1.Tag = labPg1.Width
labPg1.Width = 0
labPg1v.Caption = ""
labPg1va.Caption = ""




End Sub


Private Sub CommandButton2_Click()

DemoProgress1


End Sub


Sub DemoProgress1()
'
' Progress Bar
'
Dim intIndex As Integer
Dim sngPercent As Single
Dim intMax As Integer
Application.Cursor = xlWait
intMax = 25
For intIndex = 1 To intMax
sngPercent = intIndex / intMax
ProgressStyle1 sngPercent, True
DoEvents
'------------------------
' Your code would go here
'------------------------
Sleep 100
Next
Application.Cursor = xlDefault
Unload Me
End Su

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=48243



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On Form Start Up

change

Private Sub CommandButton2_Click()
DemoProgress1
End Sub

To

Private Sub Userform_Activate()
DemoProgress1
End Sub

--
Regards,
Tom Ogilvy


"ceemo" wrote in
message ...

Private Sub UserForm_Initialize()

' ProgressBar1
labPg1.Tag = labPg1.Width
labPg1.Width = 0
labPg1v.Caption = ""
labPg1va.Caption = ""




End Sub


Private Sub CommandButton2_Click()

DemoProgress1


End Sub


Sub DemoProgress1()
'
' Progress Bar
'
Dim intIndex As Integer
Dim sngPercent As Single
Dim intMax As Integer
Application.Cursor = xlWait
intMax = 25
For intIndex = 1 To intMax
sngPercent = intIndex / intMax
ProgressStyle1 sngPercent, True
DoEvents
'------------------------
' Your code would go here
'------------------------
Sleep 100
Next
Application.Cursor = xlDefault
Unload Me
End Sub


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:

http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Form Start Up


yep that worked


thanks


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=482433

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
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM
How do I create a button on the toolbar that will start my form? DMB Excel Discussion (Misc queries) 0 January 8th 06 11:00 PM
Start spreadsheet with WinXP start Gordon Gradwell Excel Worksheet Functions 1 July 13th 05 11:35 AM
Form start position drewdog Excel Programming 2 April 6th 04 02:15 AM
can we start form by clicking hiperlink ? Konrad[_4_] Excel Programming 1 October 27th 03 07:45 PM


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