Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with the class excel.application

Status
Not open for further replies.

jtrench

Programmer
Sep 9, 2000
6
ES
I'm building an application that calls applications like Microsoft Word, Microsoft Excel and so.

When I call Microsoft Word in my aplication I code:

==========================================================

Dim appword As Word.Application

' Aquest missatge s'encarrega de carregar el Word
On Error Resume Next 'ignora els errors produits

' Comprova si hi ha alguna còpia de word en execució
Set appword = GetObject(, "Word.Application")

' Si no hi ha cap còpia en execució arranca una execució nova
If Err.Number <> 0 Then
Set appword = CreateObject(&quot;Word.Application&quot;)
End If

' inicialitza la variable d'errors
Err.Clear

' Mostra el word
appword.Visible = True
appword.WindowState = wdWindowStateMaximize


On Error GoTo 0

=========================================================

The previous code opens Microsoft Word only if it is not running. After it makes Microsoft Word visible and maximizes it.

I use the same code to open Microsoft Excel. In this case I look that Excel opens and inmediately closes, Microsoft word remains open.

The code for the case of Microsoft Excel is:

==========================================================

Dim appexcel As Excel.Application

' Aquest missatge s'encarrega de carregar el Excel
On Error Resume Next 'ignora els errors produits

' Comprova si hi ha alguna còpia de word en execució
Set appexcel = GetObject(, &quot;Excel.Application&quot;)

' Si no hi ha cap còpia en execució arranca una execució nova
If Err.Number <> 0 Then
Set appexcel = CreateObject(&quot;Excel.Application&quot;)
End If

' inicialitza la variable d'errors
Err.Clear

' Mostra el word
appexcel.Visible = True
appexcel.WindowState = xlMaximized

On Error GoTo 0

=========================================================

What can I do if I want that Microsoft Excel remains open after the previous code?



Thanks

PD: Sorry for my english


[sig][/sig]
 
With appexcel
.Visible = True
.Workbooks.Add
End With [sig]<p>Jim<br><a href= > </a><br>oracle, vb, some javascript[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top