Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Visual Basic (VB 4/5/6) » General Visual Basic » Dim xlApp As Excel.Application


Dim xlApp As Excel.ApplicationExpand / Collapse
Author
Message
Posted 9/5/2008 11:44:20 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/5/2008 7:08:15 PM
Posts: 2, Visits: 10

I am working through a step by step guide to Visual Basic.NET 2002 and have reached a point where I wish to automate Excel from VB and I can't assign the type  Excel.Application

The line in the code is Dim xlApp As Excel.Application

It tells me the type is not defined.

Being an old version, the book tells me to Add Reference Microsoft Excel 10.0 Object Library, I have added Excel 12.0 Object library and I wonder if that is causing the problem.

Thanks.



Give Blood.
Post #25651
Posted 9/6/2008 5:20:03 AM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: Yesterday @ 3:25:33 AM
Posts: 846, Visits: 5,126
This is vb6 forum. You need to ask in the vb net forum.

I would help but I don't have Excel. Have you tried googleing for answer?

Wayne

I know enough to be dangerious.

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.

Post #25655
Posted 9/7/2008 10:32:20 AM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: Yesterday @ 7:34:31 PM
Posts: 1,465, Visits: 3,404
Welcome to A1vbcode Pocketknight.

Pocketknight (9/5/2008)

I am working through a step by step guide to Visual Basic.NET 2002

As Wayne says this is the VB6 forum you need to post in Visual Basic .NET/2005/2008

As for making References to Excel in VB6 you have done the correct procedure.

Keith

http://www.martin2k.co.uk/forums/

I've been programming with VB for 12 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Post #25658
Posted 9/8/2008 12:22:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/5/2008 7:08:15 PM
Posts: 2, Visits: 10
Thanks to you both. I don't know how I ended up here.

Give Blood.
Post #25660
Posted 9/19/2008 10:06:22 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 10/14/2008 12:47:36 PM
Posts: 17, Visits: 20
Even after you add the Excel reference to your project; you have to add its namespace before using it.

Imports Microsoft.Office.Interop

Imports Microsoft.Office.Interop

Module Module1

Sub Main()

Dim xlApp As Excel.Application

Post #25732
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Brian, Peter

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 6:58am