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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Excel in VB.net

Status
Not open for further replies.

RoguePoet01

Programmer
Oct 1, 2003
302
US
Hi,

I have used Excel in VB6 extensively in the past.

Now that we're moving up to VB.net, I've noticed that some of the things regarding Excel aren't the same.

I particular I need to write data to the Excel spreadsheet, then print out the chart that's associated with that data.

I was hoping somebody knew of a comprehensive website that might be focused mostly on Excel, VB.net, and their interaction.

Thanks,

Rougy
 
Rougy,

I am integrating VB.NET and Access by adding Microsoft Access 10.0 object library.
This refrence exposes all commands in access (VBA), and there is hardly anything that I could not use. Though I am using access primarily for reports purposes.

This code might help you, you can modify for Excel after you add Microsoft Excel Object10.0 library to your refrences.

code snippet:
...............................
Dim strSQLrpt As String
strSQLrpt = "Select * from ....."
Dim rptNew As New Access.Application
With rptNew
.Visible = True
.DoCmd.Maximize()
.OpenCurrentDatabase ("S:\Reports\ACAD_Reports_App.mde", False)
.CurrentDb.QueryDefs("qry_BldgCodes").SQL = strSQLrpt
.DoCmd.OpenReport("rpt_BldgCodes", Access.AcView.acViewPreview)
End With

....................................

You will adding a COM onbject to your project refrences and technically your VB.NET code will be called as unManaged code.
I don't know yet what classes are available if any, for microsoft office in .NET.

I hope this info may be useful for you.

Enjoy !

Vinidel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top