Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBE code pane

Quartz,

VBA code is stored in the CodeModule of a VBComponent. A CodePane
is the visible representation of the CodeModule. A CodePane is
one of many types of a Window. Other Windows include the main VBE
window itself, the project explorer, the immediate window, etc.


2. If I have code stored in a sheet module, how can I get a

reference to the code pane that that sheet module is in?

To access the CodePane of a worksheet's code, use something like
the following:

Dim VBComp As VBIDE.VBComponent
Dim VBCodeMod As VBIDE.CodeModule
Dim VBCodePane As VBIDE.CodePane

Set VBComp = ThisWorkbook.VBProject.VBComponents( _
Worksheets("Sheet1").CodeName)
Set VBCodeMod = VBComp.CodeModule
Set VBCodePane = VBCodeMod.CodePane
Debug.Print VBCodePane.CountOfVisibleLines

3. How can you determine or equate the code pane object to any

other object in the VBE using VBA?

I'm not entirely sure what you are asking here, but you can get
to the VBComponent of a CodePane with code like the following:

Set VBComp = VBCodePane.CodeModule.Parent

To get to the VBProject containing a given CodePane, use

Dim VBProj As VBIDE.VBProject
Set VBProj = VBCodePane.CodeModule.Parent.Collection.Parent

For more information, see www.cpearson.com/excel/vbe.htm and
www.cpearson.com/excel/codemods.htm



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"quartz" wrote in message
...
Hello. I'm hoping an MVP or someone who knows can help me here.

1. Can someone please explain to me what a "CodePane" is and

how it differs from a "CodeModule" or, for that
matter, a window?

2. If I have code stored in a sheet module, how can I get a

reference to the code pane that that sheet module is in?

3. How can you determine or equate the code pane object to any

other object in the VBE using VBA?

4. Your example code regarding 2 & 3 above would be most

appreciated.

Thanks in advance for your assistance.



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
can i get the "message pane" underneath the "threads pane" instea Rich Mcc Excel Worksheet Functions 2 March 3rd 06 10:18 AM
Getting Started Pane Sarge New Users to Excel 1 November 24th 05 12:03 AM
How do I JUMP from pane 1 to Pane 2? Ken Jarvis Excel Worksheet Functions 5 November 14th 05 05:51 PM
VBE code pane Bob Phillips[_6_] Excel Programming 0 January 21st 04 02:54 PM
Logitech's newest mouse scroll fails in VBE code pane Robin Hammond Excel Programming 0 July 11th 03 02:29 PM


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