Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
How to stop a VBA Module from opening Rick S. Excel Programming 2 February 14th 08 07:26 PM
opening a workbook from an windows forms app Sven[_8_] Excel Programming 3 June 1st 07 03:45 PM
Stop the _Change event? Is there EnableEvents for Forms? T_o_n_y Excel Programming 3 January 21st 07 09:39 PM
Opening User Forms MAWII Excel Programming 2 July 29th 05 04:36 PM


All times are GMT +1. The time now is 06:24 PM.

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"