ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Working with the forms in different workbooks... (https://www.excelbanter.com/excel-worksheet-functions/173376-working-forms-different-workbooks.html)

Joe_Germany

Working with the forms in different workbooks...
 
Hello all,

I think its bit difficult to explain, but let me try.....

I have two xls files - Main.xls & Feature_Compare.xls
In each file I have a Public Function (in Module) named "showform"
which will initiate the Showing of the respective form.

My code is as follows.... This code is in the Form of Main.xls


'************************************************* ******

' IsFileOpen checks if the file is open or not....
If IsFileOpen(BaseFolder & "Feature_Compare.xls") Then
Workbooks("Feature_Compare.xls").Close False
End If

Me.Hide
Workbooks.Open BaseFolder & "Feature_Compare.xls"
ActiveWorkbook.Worksheets("Blank").Activate
Application.Run "Feature_Compare.xls!showform"
ThisWorkbook.Close False

'************************************************* ******

OBSERVATION:

the code, Application.Run "Feature_Compare.xls!showform", will show
the Form. But until that form is not closed, the last line,
"ThisWorkbook.Close False", will not get executed.

When I close that Form, the Main.xls gets closed.


MY PROBLEM:

I have a similar code in the "Feature_Compare.xls" also.
So when I switch from "Feature_Compare.xls" to the "Main.xls", it will
make the form in the Main.xls to show. But the "Feature_Compare.xls"
is still open because it will be closed only when I close the form.

Because of this, When I try to go back to the form in
"Feature_Compare.xls", since the previous code was not fully complete,
this above code is not working properly.


If my explanation may not be fully understandable, please let me
know..

Any help will be really be appreciated....


Thanks
Joe


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com