ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   application.visible problem (https://www.excelbanter.com/excel-programming/344212-application-visible-problem.html)

Pierre via OfficeKB.com[_2_]

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

Bob Phillips[_6_]

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




Ken Macksey

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



Pierre via OfficeKB.com[_2_]

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

Pierre via OfficeKB.com[_2_]

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

Ken Macksey

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



Pierre via OfficeKB.com[_2_]

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

Ken Macksey

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



Ken Macksey

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




All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com