![]() |
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 |
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 |
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 |
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 |
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 |
On Form Start Up
Oh Yeh!
I better go to bed! |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com