Hi gang. This a simple macro to open the VBE to a given module of a
given workbook for editing. It work perfectly for any workbook except
the Personal Macro Workbook. Is the PMW under some vague (if not
sloppy) protection as this implies?

Dim w As Workbook
Set w = Workbooks.Open(Filename:="J:\Test.xls")
w.VBProject.VBComponents("Bzzz").CodeModule.CodePane.Show
SendKeys "^{end}"

(In case you’re wondering, the macro does not live *in* the PMW.)

For any other workbook, this code brings up the Bzzz module in the
foreground. When tried on the PMW it does indeed open the VBE but the
foreground code window is chosen seemingly at random. Any of its 4
regular modules may end up with the focus, as well as the one userform
code window. The only window that never comes up is ThisWorkbook.
Often (but not consistently) the FIRST attempt in a given session brings
up the correct module, but the majority of later attempts won’t. The
workbook isn’t very old, hasn’t been terribly active, and has never been
fed poor-quality meat.

I’ve experimented with the lines below, in various permutations, in
addition to (and instead of) the .Show line above. Nothing seems to
make a difference.

w.VBProject.VBComponents("Module3").CodeModule.CodePane.Show
w.VBProject.VBComponents("Module3").CodeModule.CodePane.Window.SetFocus
w.VBProject.VBComponents("Module3").Activate

Is there a secret to this? TIA TIA TIA.

-----------------------
Mark Tangard
"Life is nothing if you're not obsessed." --John Waters