Open Excel using VBA

M

moglione1

Hi all,

Can somebody please provide me with the VBA code that opens a new Excel
Application and not Excel Workbook.

I.e. I need two instances of Excel running - 1 that contains the code
to open the second instance.

THANKING YOU ALL
 
D

Dave Peterson

I'm not sure why you want another instance of excel, but...


Option Explicit
Sub testme()
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
End Sub
 
M

moglione1

Thank you very much for your response but that does not QUITE work.

Basically it does open the other instance of EXCEL. But then it closes
it back down.

Anyway around this at all. I am new to VBA so dont fully understand it
yet.

Thank you very much
 
D

Dave Peterson

What happens if you do something in that instance?

Option Explicit
Sub testme()
Dim xlApp As Object
Dim xlWkbk As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWkbk = xlApp.Workbooks.Add
End Sub

If you don't want that empty workbook hanging around:

Option Explicit
Sub testme()
Dim xlApp As Object
Dim xlWkbk As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWkbk = xlApp.Workbooks.Add
xlWkbk.Close savechanges:=False
End Sub
 
Top