Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a workbook visible

I have the following code:

Dim DumpXlApp As Excel.Application = New Excel.Application
Dim DumpWkBk As Excel.Workbook
DumpWkBk = System.Runtime.InteropServices.Marshal.BindToMoniker(FilePath)
DumpXlApp = DumpWkBk.Parent
DumpXlApp.Visible = True

I can't get the DumpWkBk workbook to become visible. Is the issue DumpXlApp = DumpWkBk.Parent line? I don't think it is the BindToMoniker line because I can do things with DumpWkBk.

like image 379
JoeB Avatar asked Jul 03 '26 11:07

JoeB


1 Answers

I have seen that when BindToMoniker is used in Excel, often the window ends up being hidden. The workbook is still open and accessible to code, it just does not appear in the user interface.

Try also calling this after your other code:

DumpXlApp.Windows(DumpWkBk.Name).visible = true
like image 138
Daniel Avatar answered Jul 06 '26 03:07

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!