Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default sheet code window

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default sheet code window

Simply right-click the sheet tab and View code, or is there some other
reason you need to do this with code.

Regards,
Peter T

"rslc" ,nz" wrote in message
...
Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default sheet code window

Hi Russ,

Try the following:

Sub DisplaySheetCodeWindow()
Dim ShtComp As VBComponent

Set ShtComp = ThisWorkbook.VBProject.VBComponents("Sheet1")

ShtComp.CodeModule.CodePane.Show
End Sub

Hope this helps
--
A. Ch. Eirinberg


"rslc" ,nz" wrote:

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default sheet code window

To use Howard's code, while in the VBA editor, if not already done, you might
need to select Tools - References and check the box (Ensure you check the
box; don't just hightlight the line) against Microsoft Visual Basic for
Applications Extensibility 5.3.

In addition to above need to provide access to the VBA project. Select a
worksheet then:-
xl2007:-
Microsoft button - Excel options - Trust Center - Trust Center settings
- Macro Settings - check the box against Trust access to the VBA project
object model.

Earlier versions of xl:-
Tools - Options - Security tab - Macro Security button - Trusted sources
tab - Check the box against Trust access to visual basic project.

--
Regards,

OssieMac


"Howard31" wrote:

Hi Russ,

Try the following:

Sub DisplaySheetCodeWindow()
Dim ShtComp As VBComponent

Set ShtComp = ThisWorkbook.VBProject.VBComponents("Sheet1")

ShtComp.CodeModule.CodePane.Show
End Sub

Hope this helps
--
A. Ch. Eirinberg


"rslc" ,nz" wrote:

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default sheet code window

Thanks Ossie,

You were right! I didn't realise it, because I already had the reference for
Microsoft Visual Basic for Applications Extensibility 5.3. in the workbook
I've used to test this code. I have tried running this code without this
reference and it did not work!
--
A. Ch. Eirinberg


"OssieMac" wrote:

To use Howard's code, while in the VBA editor, if not already done, you might
need to select Tools - References and check the box (Ensure you check the
box; don't just hightlight the line) against Microsoft Visual Basic for
Applications Extensibility 5.3.

In addition to above need to provide access to the VBA project. Select a
worksheet then:-
xl2007:-
Microsoft button - Excel options - Trust Center - Trust Center settings
- Macro Settings - check the box against Trust access to the VBA project
object model.

Earlier versions of xl:-
Tools - Options - Security tab - Macro Security button - Trusted sources
tab - Check the box against Trust access to visual basic project.

--
Regards,

OssieMac


"Howard31" wrote:

Hi Russ,

Try the following:

Sub DisplaySheetCodeWindow()
Dim ShtComp As VBComponent

Set ShtComp = ThisWorkbook.VBProject.VBComponents("Sheet1")

ShtComp.CodeModule.CodePane.Show
End Sub

Hope this helps
--
A. Ch. Eirinberg


"rslc" ,nz" wrote:

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default sheet code window


Try something like

ThisWorkbook.VBProject.VBComponents( _
ActiveSheet.CodeName).CodeModule.CodePane.Show

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Mon, 25 May 2009 20:00:51 +1200, rslc ,nz"
wrote:

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default sheet code window

An other way of doing it (without needing a reference to Microsoft Visual
Basic for
Applications Extensibility 5.3. is by using the following code:

CommandBars("Ply").Controls("&View Code").Execute

"rslc" ,nz" wrote in message
...
Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default sheet code window

Thank you it works perfectly, just knew it would be something simple!

cheers
rslc







Chip Pearson wrote:
Try something like

ThisWorkbook.VBProject.VBComponents( _
ActiveSheet.CodeName).CodeModule.CodePane.Show

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Mon, 25 May 2009 20:00:51 +1200, rslc ,nz"
wrote:

Hi
is it possible to display the worksheet code window with vba or a
macro.
thanks
rslc

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
VBA line of code executes in Immediate Window but not in Code Window [email protected] Excel Discussion (Misc queries) 2 April 30th 07 02:52 PM
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
How to Link on [Sheet(1) Window(1)] to [Sheet(2) Window(2)] ? EagleOne Excel Discussion (Misc queries) 0 November 22nd 06 03:48 PM
Duplicated code window and userform window problem Zhu Excel Programming 3 November 8th 06 05:09 AM
Immediate Window not showing up below code window ExcelMonkey Excel Programming 1 March 22nd 06 12:02 AM


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

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"