Vb.net Excel Workbook Lost its Focus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymittal
    New Member
    • Feb 2008
    • 1

    Vb.net Excel Workbook Lost its Focus

    Hi,

    I am using the single Excel app object through out in my application. I used the SetParent API to fit the excel in the window. When I first access the object and open the workbook, it work fine and the focus remains on the workbook.

    I closed the window by closing the workbook and reset its parent. When I open it at the second time, focus will lost from the window and I do nothing on the workbook.

    I used SetForegroundWi ndow API, activate method but it does not work.

    I am sending the code, that I am using:-

    System.Threadin g.Thread.Curren tThread.Current Culture = New System.Globaliz ation.CultureIn fo("en-US")

    mxlBook = goExcel.ExcelAp p.Workbooks.Ope n(gsFldrStock & "temp\table \" & excelfilenameWi thPath)


    System.Threadin g.Thread.Curren tThread.Current Culture = oldCI
    goExcel.ExcelAp p.Visible = True
    fraExcel.Visibl e = True

    goExcel.SetAppS ize(fraExcel, 0, True)
    goExcel.SetPare nt(fraExcel.Han dle.ToInt32)


    Thanks in advance.
Working...