PC Review


Reply
Thread Tools Rate Thread

Application.Visible=False

 
 
David
Guest
Posts: n/a
 
      20th May 2010
Just toying with some ideas...

1) Any way to recover the application after the above command and then
crashing?

2) Anyone got error handling code to show the application and also preserve
the 'original' error message and ability to go to the offending line of code
with 'Debug'?
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      20th May 2010
Hi David

1.
Application.Visible = False
'some code here
Application.Visible = True

2. Refer the below link on using ERL function

http://www.fmsinc.com/free/NewTips/V...inenumber.html


--
Jacob (MVP - Excel)


"David" wrote:

> Just toying with some ideas...
>
> 1) Any way to recover the application after the above command and then
> crashing?
>
> 2) Anyone got error handling code to show the application and also preserve
> the 'original' error message and ability to go to the offending line of code
> with 'Debug'?

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      20th May 2010
If this is happening when you're testing, then you could use a VBS script to
unhide the hidden excel application.

I wouldn't expect any user to go through all this, though. I'd only use it
while testing the code.

========
dim myXL
On Error Resume Next
Set myXL = GetObject(, "Excel.Application")
If Err.Number = 429 Then
msgbox "Excel is not running"
else
myxl.visible = true
end If
On Error GoTo 0
Set myxl = nothing
=======

Copy the stuff between the "========" lines and paste into NotePad. Then save
it as a nicely named .vbs file (UnhideXL.vbs ???).

The bad news is that if you have several hidden instances of excel, you'll have
to close the visible instance, unhide, close, unhide, ...

You can pop up the task manager (ctrl-shift-Escape is one way), look at the
processes tab to determine how many excel.exe's are running (visible or hidden).

Again, I wouldn't make this part of the user experience. But it's good while
developing.

The .VBS file that I use includes other office programs:

======
dim myXL
On Error Resume Next
Set myXL = GetObject(, "Excel.Application")
If Err.Number = 429 Then
msgbox "Excel is not running"
else
myxl.visible = true
end If
On Error GoTo 0
Set myxl = nothing

dim myWord
On Error Resume Next
Set myWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
msgbox "Word is not running"
else
myWord.visible = true
end If
On Error GoTo 0
Set myWord = nothing

dim myOutlook
On Error Resume Next
Set myOutlook = GetObject(, "outlook.Application")
If Err.Number = 429 Then
msgbox "Outlook is not running"
else
myOutlook.visible = true
end If
On Error GoTo 0
Set myOutlook = nothing

dim myPPT
On Error Resume Next
Set myPPT = GetObject(, "Powerpoint.Application")
If Err.Number = 429 Then
msgbox "Power Point is not running"
else
myPPT.visible = true
end If
On Error GoTo 0
Set myPPT = nothing

dim myAcc
On Error Resume Next
Set myPPT = GetObject(, "Access.Application")
If Err.Number = 429 Then
msgbox "Access is not running"
else
myAcc.visible = true
end If
On Error GoTo 0
Set myAcc = nothing
===========

(just in case you need it.)

David wrote:
>
> Just toying with some ideas...
>
> 1) Any way to recover the application after the above command and then
> crashing?
>
> 2) Anyone got error handling code to show the application and also preserve
> the 'original' error message and ability to go to the offending line of code
> with 'Debug'?


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Calculation is faster when visible than when Visible=False? JeffDotNet Microsoft Excel Programming 9 8th Apr 2008 06:35 AM
Application.Visible = False SimonB Microsoft Excel Setup 1 16th Oct 2006 09:51 PM
Application.Visible = False SimonB Microsoft Excel Misc 1 15th Oct 2006 01:10 PM
Switching Panels using Visible =true & Visible=false; Kristof Taveirne Microsoft Dot NET Compact Framework 1 28th Jun 2006 03:50 PM
Switching Panels using Visible =true & Visible=false; Kristof Taveirne Microsoft C# .NET 2 28th Jun 2006 01:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 PM.