Excel Workbooks

Add-in Express™ Support Service
That's what is more important than anything else

Excel Workbooks
Excel Workbook opening another Workbook 
Michael Kaden


Guest


Dear Andrei,

I believe the following screenshot explains it best:

http://www.alerasoftlib.de/ADX/MWB.jpg

I open the workbook

210823 Input Named ranges Rev01.xlsm

With the Excel Ribbon Button, I open a WINForm (Excel Data Source) which has a WPF Form through ElementHost

With the WPF Button "Look at Data File" I open the Excel File "Daten_RevA.xlsx"

The opening line is

Dim wbs As Excel.Workbooks = AddinModule.CurrentInstance.ExcelApp.Workbooks
Dim wb As Excel.Workbook = Nothing
wb = wbs.Open(DataFile, 0, True) 


I do not want to close the WINForm (Excel Data Source) but I cannot work with the Data File, I can not even use the close button on the Data File. See the message in the picture.

I think this is because of

Dim wbs As Excel.Workbooks = AddinModule.CurrentInstance.ExcelApp.Workbooks

so as both Workbooks are in one Workbooks collection the WinForm (modal = ShowDialog) blocks the Datafile, but I could not find any other ways including opening the second EXCEL File through a SHELL statement. Of course I could resolve it by making the WinForm non-modal (Show) but in my experience the "normal" user is not careful enough to close it manually.

Do you know another way to open the second file and make it independent of the WinForm.

Thank you & kind regards

Michael
Posted 02 Sep, 2021 15:21:24 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Michael,

It looks like your WPF form is opened modally. You should open it as non-modal to be able to close it after opening the other workbook.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2021 03:07:07 Top
Michael Kaden


Guest


Thank you very much Andrei,

I am aware of this.

so as both Workbooks are in one Workbooks collection the WinForm (modal = ShowDialog) blocks the Datafile, but I could not find any other ways including opening the second EXCEL File through a SHELL statement. Of course I could resolve it by making the WinForm non-modal (Show) red


So I would like to know if you know a way to open the Daten Workbook programmatically as I can do manually, i.e When the WinForm is open, I can manually open a new Excel Workbook Instance by holding down the "ALT" key and open the Daten Workbook. This then does not depend on the WinForm.

But I cannot find out how to do this programmatically? Hope that you know how.

thank you & kind regards

Michael
Posted 03 Sep, 2021 03:41:56 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Michael,

You can close the form first and open the workbook after that.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2021 04:07:43 Top
Michael Kaden


Guest


Hello Andrei

thank you fr the tip. that works well.

kind regards

Michael
Posted 03 Sep, 2021 05:59:39 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You are welcome!

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2021 09:56:04 Top