Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JVS JVS is offline
external usenet poster
 
Posts: 5
Default Auto Open question

I have 2 workbooks, book one has no macro's just a hyperlink to workbook 2.
When workbook 2 opens, I'd like it to minimize and open UserForm1.
The only button (at this time) on the form is a cancel button that sets the
focus back on workbook1 and then closes workbook2.
The code I have below works as long as I do NOT "Auto Open" the UserForm1.

If I auto open the form using module code or Workbook_Open (below)
then when workbook2 closes, the hyperlink in Workbook1 does NOT work.

Can someone tell me how automatically open a form in workbook 2 then
properly exit the form and workbook so that the hyperlink in workbook1 will
still work with out having to exit Excel?

Code from workbook2 "This Workbook" section:
==========================================
Private Sub Workbook_Open()
Windows("Workbook2.xls").WindowState = xlMinimized
Load UserForm1
UserForm1.Show
End Sub

UserForm1 "Cancel" button Code as follows:
==========================================
Private Sub cmdExit_Click()
Workbooks("Workbook2.xls").Close
End Sub

Thanks!
Johnny


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Auto Open question

Jvs wrote:
Can someone tell me how automatically open a form in workbook 2 then
properly exit the form and workbook so that the hyperlink in workbook1 will
still work with out having to exit Excel?


I would suggest reducing Workbook_Open to

Private Sub Workbook_Open()
Application.OnTime Now, "ShowTheForm"
End Sub

With, in a standard module

Sub ShowTheForm()
ThisWorkbook.Windows(1).WindowState = xlMinimized
Load UserForm1
UserForm1.Show
End Sub


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #3   Report Post  
Posted to microsoft.public.excel.programming
JVS JVS is offline
external usenet poster
 
Posts: 5
Default Auto Open question

Thank you very much, it works fine!
Have a happy holiday!

Johnny

"Bill Manville" wrote in message
...
Jvs wrote:
Can someone tell me how automatically open a form in workbook 2 then
properly exit the form and workbook so that the hyperlink in workbook1

will
still work with out having to exit Excel?


I would suggest reducing Workbook_Open to

Private Sub Workbook_Open()
Application.OnTime Now, "ShowTheForm"
End Sub

With, in a standard module

Sub ShowTheForm()
ThisWorkbook.Windows(1).WindowState = xlMinimized
Load UserForm1
UserForm1.Show
End Sub


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



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
Auto Open problem Jim Excel Discussion (Misc queries) 1 December 7th 07 11:59 AM
how do you switch from auto open Jay Excel Discussion (Misc queries) 3 July 18th 05 04:29 PM
Auto Open Syed Zeeshan Haider Excel Discussion (Misc queries) 2 June 1st 05 03:39 PM
Auto Open won't die or go away Dee Veloper Excel Programming 0 October 29th 03 06:06 PM
Auto Open Todd[_5_] Excel Programming 2 September 4th 03 05:57 PM


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