Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi,
My application is not visible because the application works entirely within a userform. However if an error occurs, the userform is shut down and i see nothing anymore... is there a way to have excel reappear when an error appears at any time ? or is there a key combination to have excel reappear after my application is closed ? Thanks, Pierre -- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Pierre,
How are you handling the errors? Do you trap them, or do they just bomb? Are you minimizing Excel? Any code you can share? -- HTH RP (remove nothere from the email address if mailing direct) "Pierre via OfficeKB.com" <u13950@uwe wrote in message news:569dcdf4d06e7@uwe... Hi, My application is not visible because the application works entirely within a userform. However if an error occurs, the userform is shut down and i see nothing anymore... is there a way to have excel reappear when an error appears at any time ? or is there a key combination to have excel reappear after my application is closed ? Thanks, Pierre -- Message posted via http://www.officekb.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi
Put this vbscript on your desktop and just doubleclick it and excel should re-appear. Create the file with notepad and name it "Activate Excel.vbs" and save it. Dim objXL Dim strMessage On Error Resume Next ' Try to grab a running instance of ' Excel... Set objXL = GetObject(, "Excel.Application") ' What did we find?.. If Not TypeName(objXL) = "Empty" Then strMessage = "Excel Running." Else strMessage = "Excel Not Running." End If ' Feedback to user... MsgBox strMessage, vbInformation, "Excel Status" ' Make the Excel instance visible ' if we found one if strMessage = "Excel Running." then _ objXL.Visible = true Also, in your before_close code and any error trap, put Application.Visible = true HTH Ken |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi bob,
i'am using application.visible = false error handling : they just bomb... My code is very large (over 1000 lines) and put in many macro's so hard to display here... thanks,Pierre Bob Phillips wrote: Pierre, How are you handling the errors? Do you trap them, or do they just bomb? Are you minimizing Excel? Any code you can share? Hi, [quoted text clipped - 10 lines] Thanks, Pierre -- Message posted via http://www.officekb.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi Ken,
This works fine but: if there are two execl instances running, how can i get the one that has turned invisible? thanks, Pierre Ken Macksey wrote: Hi Put this vbscript on your desktop and just doubleclick it and excel should re-appear. Create the file with notepad and name it "Activate Excel.vbs" and save it. Dim objXL Dim strMessage On Error Resume Next ' Try to grab a running instance of ' Excel... Set objXL = GetObject(, "Excel.Application") ' What did we find?.. If Not TypeName(objXL) = "Empty" Then strMessage = "Excel Running." Else strMessage = "Excel Not Running." End If ' Feedback to user... MsgBox strMessage, vbInformation, "Excel Status" ' Make the Excel instance visible ' if we found one if strMessage = "Excel Running." then _ objXL.Visible = true Also, in your before_close code and any error trap, put Application.Visible = true HTH Ken -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi Pierre
I am not sure how you would get the second instance of excel other than to close the first one it finds and run it again. At least this allows you to get excel back and save any changes you might have made without losing anything. The only other suggestion I have is to rem(comment) out the Application.visible=false line until you have completely debugged your code. HTH Ken |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi Ken,
Thanks for your input. the code works fine. However, i would like to do the following when activating your code: - see if my program is active (program called vplprog.xls) - if active, i would like to - check if the sheet "waarschuwing" is visible if not visible then make this sheet visible and save and close the workbook thanks for your help.... Pierre Ken Macksey wrote: Hi Pierre I am not sure how you would get the second instance of excel other than to close the first one it finds and run it again. At least this allows you to get excel back and save any changes you might have made without losing anything. The only other suggestion I have is to rem(comment) out the Application.visible=false line until you have completely debugged your code. HTH Ken -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200511/1 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi
Adding this code to the bottom worked for me. Change the workbook and worksheet names to suit. Message box can be removed as required. Just there so you can actually see what is happening. If you don't want to close excel, remove the last line. if objxl.workbook.name = "Test.xls" then objxl.worksheets("sheet3").visible = true objxl.msgbox "" objxl.Application.displayalerts = false objxl.workbooks("Test.xls").save objxl.Application.displayalerts = True objxl.workbooks("Test.xls").close objxl.quit end if |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
application.visible problem
Hi
With further testing, this part of the code seems to work ok, but the workbook name part does not. objxl.worksheets("sheet3").visible = true objxl.Application.displayalerts = false objxl.workbooks("Test x2.xls").save objxl.Application.displayalerts = True objxl.workbooks("Test x2.xls").close objxl.quit Maybe someone else knows how to get the workbook name with vb script. HTH Ken |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.Visible = False | Setting up and Configuration of Excel | |||
Application.Visible = False | Excel Discussion (Misc queries) | |||
Visible Instances of an Application | Excel Programming | |||
Runnig Excel without visible application | Excel Programming | |||
Application.visible help | Excel Programming |