vb.net - Cannot maximize application after it was minimized -
after many tries , tribulations able minimize application winform button. code works perfectly:
private sub btnminwindow_click(sender object, e eventargs) handles btnminwindow.click 'this procedure runs when btnminwindow clicked. 'the procedure minizmizes form , excel. dim wb excel.workbook = ctype(globals.thisworkbook.application.activeworkbook, excel.workbook) me.windowstate = formwindowstate.minimized wb.application.windowstate = xlwindowstate.xlminimized end sub so of course, minimize needs maximize. assumed had right same code use xlmaximized. of course, assumption wrong. here code:
private sub btnminemployeedashboard_click(sender object, e eventargs) handles btnminemployeedashboard.click 'this procedure runs when btnemployeedashboard button clicked. dim wb excel.workbook = ctype(globals.thisworkbook.application.activeworkbook, excel.workbook) wb.application.windowstate = xlwindowstate.xlmaximized wb.sheets("employeeboard").select() me.close() end sub the code closes form, selects sheet, not maximize window. think have make variable has "already minimize" available (in scope) button _click handler , use instead of declaring new variable. unfortunately, if case, not know how that.
try instance excel object class/module/global variable, use variable perform actions on excel file while remains opened.
Comments
Post a Comment