ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Only CreateObject Syntax works. (https://www.excelbanter.com/excel-programming/328924-only-createobject-syntax-works.html)

Boomessh

Only CreateObject Syntax works.
 
Hai,

I am facing a problem while working with Excel object in VB.

I have added a reference to Excel 10.0 object library, but i am unable to
create a Excel.Application object. (I have Office XP installed in my system.)

like

Dim objExcel as New Excel.Application
( here the intellisense is not showing Excel)

but i am able to do usign Createobject syntax.

What could be the problem..

Thanks.
V.Boomessh

lucotuslim

Only CreateObject Syntax works.
 
Could be other reference that caused the problem.

I managed to do that like

Option Explicit
Dim mexcel As Excel.Application

Public Sub openexcel(ByVal s As String, ByRef item As MailItem)
Dim fso As New FileSystemObject
Dim rec As Recordset
Set mexcel = New Excel.Application
End Sub

--
Lucotus


"Boomessh" wrote:

Hai,

I am facing a problem while working with Excel object in VB.

I have added a reference to Excel 10.0 object library, but i am unable to
create a Excel.Application object. (I have Office XP installed in my system.)

like

Dim objExcel as New Excel.Application
( here the intellisense is not showing Excel)

but i am able to do usign Createobject syntax.

What could be the problem..

Thanks.
V.Boomessh


Boomessh

Only CreateObject Syntax works.
 
Hai ,

THanks for your reply,

but when i write
Dim objExcel as Excel ( and on keeping "." the intellisense gives me only
Adjustments Class and NOt Application.

I have even reinstalled the OFFICE, but no use.

Guide me, thanks,

V.Boomessh



"lucotuslim" wrote:

Could be other reference that caused the problem.

I managed to do that like

Option Explicit
Dim mexcel As Excel.Application

Public Sub openexcel(ByVal s As String, ByRef item As MailItem)
Dim fso As New FileSystemObject
Dim rec As Recordset
Set mexcel = New Excel.Application
End Sub

--
Lucotus


"Boomessh" wrote:

Hai,

I am facing a problem while working with Excel object in VB.

I have added a reference to Excel 10.0 object library, but i am unable to
create a Excel.Application object. (I have Office XP installed in my system.)

like

Dim objExcel as New Excel.Application
( here the intellisense is not showing Excel)

but i am able to do usign Createobject syntax.

What could be the problem..

Thanks.
V.Boomessh


Dave Peterson[_5_]

Only CreateObject Syntax works.
 
I don't use VB, but how about trying:

dim objExcel as Excel.Application
set objexcel = new excel.application

This kind of thing works ok for me in MSWord (with that reference set).

Actually, both these worked ok (from MSWord):

Option Explicit
Sub testme()
Dim objExcel As Excel.Application
Set objExcel = New Excel.Application
objExcel.Visible = True
objExcel.Workbooks.Add
End Sub

Sub testme2()
Dim objExcel As New Excel.Application
objExcel.Visible = True
objExcel.Workbooks.Add
End Sub

Any chance that excel is just closing before you want it to close. I had to do
something in excel (workbooks.add was enough) to keep it open after both of the
routines ran.

Boomessh wrote:

Hai,

I am facing a problem while working with Excel object in VB.

I have added a reference to Excel 10.0 object library, but i am unable to
create a Excel.Application object. (I have Office XP installed in my system.)

like

Dim objExcel as New Excel.Application
( here the intellisense is not showing Excel)

but i am able to do usign Createobject syntax.

What could be the problem..

Thanks.
V.Boomessh


--

Dave Peterson


All times are GMT +1. The time now is 11:44 AM.

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