none
Bring newly opened workbook to front RRS feed

  • Question

  • I have developed a VSTO addin (in VB.NET) for Excel.   One procedures opens a new workbook (Workbook B) in an already active Excel application (the user already has a workbook open= Workbook A), but I can't figure out how to bring that newly opened workbook (Workbook B) to the top window.  Here's my code, which opens the new workbook, but doesn't bring it to the front. 

    xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")
    
    xlApp.Visible = true
    
    xlWBTempB - xlApp.Workbooks.Open(filePath, [ReadOnly]:=True, UpdateLinks:=True)
    
    xlWBTempB.Activate()


    Any suggestions?


    Gina

    Tuesday, February 11, 2014 7:51 PM

Answers

  • Now, I'm trying again, and ".Activate" seems to work.   I don't know what's different.

    Gina

    • Marked as answer by Gina1111 Tuesday, February 11, 2014 7:56 PM
    Tuesday, February 11, 2014 7:56 PM