Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop Module, Forms opening
Hi,
How (If possible) can i stop XL opening all the Module windows when i either open a Workbook or activate it please? Thanks John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop Module, Forms opening
John;385585 Wrote: Hi, How (If possible) can i stop XL opening all the Module windows when i either open a Workbook or activate it please? Thanks John When you say all the module windows on opening do you mean the VBA module windows when you open the VBE or do you mean the worksheets? -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=107828 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop Module, Forms opening
Simon Lloyd;385589 Wrote: When you say all the module windows on opening do you mean the VBA module windows when you open the VBE or do you mean the worksheets?I am assuming you want the VBA module windows closed, firstly in the VBE you must go to TOOLSREFERENCES and click the check box next to -Microsoft Visual Basic for Applications Extensibility 5.3- without this it will always fail at the project commands, next add this to the thisworkbook module: Code: -------------------- Private Sub Workbook_Open() Dim WB As Workbook Dim VBP As VBProject, PrWin As VBIDE.Window Dim i As Integer Set VBP = ThisWorkbook.VBProject Set wbActive = ActiveWorkbook 'Close all code windows For Each oWin In VBP.VBE.Windows If InStr(PrWin.Caption, "(") 0 Then PrWin.Close Next PrWin End Sub -------------------- now ehn your workbook opens it will close all vbe module windows. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=107828 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop Module, Forms opening
Hi Simon,
Thanks for the solution. It works great. I guess i should have been a little more clearer. I'm running a loop in a procedure to open a number of workbooks. What i would like is each time a Workbook is opened none of the VBA modules forms open. Is this possible to code this in my loop please? Thanks John "Simon Lloyd" wrote: Simon Lloyd;385589 Wrote: When you say all the module windows on opening do you mean the VBA module windows when you open the VBE or do you mean the worksheets?I am assuming you want the VBA module windows closed, firstly in the VBE you must go to TOOLSREFERENCES and click the check box next to -Microsoft Visual Basic for Applications Extensibility 5.3- without this it will always fail at the project commands, next add this to the thisworkbook module: Code: -------------------- Private Sub Workbook_Open() Dim WB As Workbook Dim VBP As VBProject, PrWin As VBIDE.Window Dim i As Integer Set VBP = ThisWorkbook.VBProject Set wbActive = ActiveWorkbook 'Close all code windows For Each oWin In VBP.VBE.Windows If InStr(PrWin.Caption, "(") 0 Then PrWin.Close Next PrWin End Sub -------------------- now ehn your workbook opens it will close all vbe module windows. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=107828 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop Module, Forms opening
In that case john the code would need to reside in your PERSONAL.xls this base workbook can house the code that you wish to run on each active wrokbook. John;385730 Wrote: Hi Simon, Thanks for the solution. It works great. I guess i should have been a little more clearer. I'm running a loop in a procedure to open a number of workbooks. What i would like is each time a Workbook is opened none of the VBA modules forms open. Is this possible to code this in my loop please? Thanks John "Simon Lloyd" wrote: Simon Lloyd;385589 Wrote: When you say all the module windows on opening do you mean the VBA module windows when you open the VBE or do you mean the worksheets?I am assuming you want the VBA module windows closed, firstly in the VBE you must go to TOOLSREFERENCES and click the check box next to -Microsoft Visual Basic for Applications Extensibility 5.3- without this it will always fail at the project commands, next add this to the thisworkbook module: Code: -------------------- Private Sub Workbook_Open() Dim WB As Workbook Dim VBP As VBProject, PrWin As VBIDE.Window Dim i As Integer Set VBP = ThisWorkbook.VBProject Set wbActive = ActiveWorkbook 'Close all code windows For Each oWin In VBP.VBE.Windows If InStr(PrWin.Caption, "(") 0 Then PrWin.Close Next PrWin End Sub -------------------- now ehn your workbook opens it will close all vbe module windows. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' ('The Code Cage - Microsoft Office Help - Microsoft Office Discussion' (http://www.thecodecage.com)) ------------------------------------------------------------------------ Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1) View this thread: 'Stop Module, Forms opening - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=107828) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=107828 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I stop blank workbook from opening when opening an existing | Excel Discussion (Misc queries) | |||
How to stop a VBA Module from opening | Excel Programming | |||
opening a workbook from an windows forms app | Excel Programming | |||
Stop the _Change event? Is there EnableEvents for Forms? | Excel Programming | |||
Opening User Forms | Excel Programming |