View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
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