Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default How does Personal Macro Workbook become personal.xls

I use Excel 2003 in Windows Vista.
Application.StartupPath & "\personal.xls" is hidden, holding VBA code.

On closing Excel after changing code, I get the invitation: "Do you want
to save the changes you made to the Personal Macro Workbook? If you
click Yes, the macros will be available the next time you start
Microsoft Office Excel."

Occasionally, I instead get:
"Do you want to save the changes you made to personal.xls?".

This is because I UNINTENTIONALLY unhide the hidden file.
The correction is easy - click Window/Hide.

I would like to know how to detect the operation that unhides the file?
I hope the answer to this question will be generally useful.
--
Walter Briscoe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default How does Personal Macro Workbook become personal.xls

I don't think there is specific event for this but you can try using
the WindowActivate event of the thisWorkbook object.
Try putting this one in and see where it leads you:
1. in VBA navigate to ThisWorkbook object of the Personals.xls in the
object explorer (left hand pane)
2. double click it to open its code on the right hand side
3. in the code body put this:
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
MsgBox Me.Name & " just got activated!"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default How does Personal Macro Workbook become personal.xls

In message
..com of Mon, 29 Mar 2010 07:31:26 in microsoft.public.excel.programming
, AB writes
I don't think there is specific event for this but you can try using
the WindowActivate event of the thisWorkbook object.
Try putting this one in and see where it leads you:
1. in VBA navigate to ThisWorkbook object of the Personals.xls in the
object explorer (left hand pane)
2. double click it to open its code on the right hand side
3. in the code body put this:
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
MsgBox Me.Name & " just got activated!"
End Sub


Thank you, I have done so.
1) I opened Excel and used Alt F+C to close Book1.
2) I used Alt+F11 to open VBA. Code in the last module (Module2) of
personal.xls opened in a single pane.
3) I used Ctrl+R to open "Project - VBAProject" in the left hand pane
4) I double-clicked "Microsoft Excel Objects" to expand it.
5) In that expansion, I double-clicked ThisWorkBook to open its code
window in the right hand pane.
6) In that code window, I put
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
MsgBox Me.Name & " just got activated!"
End Sub
7) I double-clicked Module2 to open its code.
8) I closed "Project - VBAProject" by clicking its "X" to restore the
single page view.
9) I used Ctrl+S to save personal.xls.
10) I checked the code is now in place. I will report any results.
--
Walter Briscoe
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default How does Personal Macro Workbook become personal.xls

In message of Tue, 30 Mar 2010
07:02:43 in microsoft.public.excel.programming, Walter Briscoe
writes
In message
.com of Mon, 29 Mar 2010 07:31:26 in microsoft.public.excel.programming
, AB writes
I don't think there is specific event for this but you can try using
the WindowActivate event of the thisWorkbook object.


[snip]

Thank you, I have done so.


[snip]

10) I checked the code is now in place. I will report any results.


The code detects the result of a sheet losing its hidden property, but
is not sufficiently fine-grained to detect the operation which does it.

I will leave the code in place as a guard and wait to become more
competent in dealing with events. ;(
Thanks, AB ;)
--
Walter Briscoe
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default How does Personal Macro Workbook become personal.xls

In message of Mon, 12 Apr 2010
12:21:13 in microsoft.public.excel.programming, Walter Briscoe
writes
In message of Tue, 30 Mar 2010
07:02:43 in microsoft.public.excel.programming, Walter Briscoe
writes
In message
.com of Mon, 29 Mar 2010 07:31:26 in microsoft.public.excel.programming
, AB writes
I don't think there is specific event for this but you can try using
the WindowActivate event of the thisWorkbook object.


[snip]

Thank you, I have done so.


[snip]

10) I checked the code is now in place. I will report any results.


The code detects the result of a sheet losing its hidden property, but
is not sufficiently fine-grained to detect the operation which does it.

I will leave the code in place as a guard and wait to become more
competent in dealing with events. ;(
Thanks, AB ;)


I have done a little more on this.
I reduced the number of sheets to 1 to simplify the problem.
I am closer to finding the offending sequence of operations.
It seems to be necessary (but not sufficient) to say "OK" to "This
action will reset your project, proceed anyway?" and later save
personal.xls within the VBE. (Excel sometimes loses its way and I do
occasional manual saves of personal.xls to minimise that risk.)

In Excel of personal.xls, Window\Hide and Window\Unhide write to
Workbooks("personal.xls").Windows.Item(1).Visible.

I would like to know how automatically to set a watch on that location.

I have made the VBIDE visible. I can't find anything about the structure
of watches in "Excel 2002 VBA". Perhaps I can run the Add Watch dialog.

In any case, I reckon to set the watch in workbook event procedures in
personal.xls. I hope to get there, but am happy to accept any help. ;)
--
Walter Briscoe
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
Personal Macro Workbook Gowri Excel Programming 2 December 15th 09 04:56 PM
Personal Macro Workbook Chilvers Excel Discussion (Misc queries) 1 December 5th 07 03:16 PM
Where is Personal Macro Workbook? fxcel Excel Discussion (Misc queries) 2 June 17th 06 02:26 PM
No Personal Macro Workbook? Kou Vang[_2_] Excel Programming 2 February 3rd 06 05:05 PM
Personal macro workbook and personal.xls John Kilkenny Excel Discussion (Misc queries) 1 June 14th 05 09:43 PM


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