borderAndreaVB free resources for Visual Basic developersborder

ASP.NET 3.5 Hosting - DiscountASP.NET

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (help VB6 Making layout for printing) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Printing report With excel
Poster Message
noknok
Level: Scholar

Registered: 23-11-2007
Posts: 32

icon Printing report With excel

After saving the information in my database i want to print the information using the excel which has a layout, how im going to connect my excel to my database

like example

lnametxt.text = A1 in my excel how to do that




31-01-2008 at 05:56 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 991
icon Re: Printing report With excel

Hi
Google for "Automating Excel using VB" and work from there.
Also, this appears to be a duplicate post from http://www.andreavb.com/forum/viewtopic.php?TopicID=8118&page=0#26616

In essence:
Create a project
Add a reference to Microsoft Excel Object Library
The code below creates a new workbook and puts data into it


public sub ExcelDemo()
dim objApp as excel.application
dim objWB as excel.workbook
dim objWS as excel.worksheet

' Connect to excel
set objapp = new excel.applcation

' Create a new workbook
set objwb = objapp.workbooks.add()

' Create a new worksheet
set objWS = objwb.worksheets.add("funkytest")

' Update some text
dim objRange as excel.range

set objrange = objWS.Range("A1")
objrange.value = "34.565"

' close excel without saving
set objws = nothing
objWB.close false
objApp.quit

end sub


Hope it helps
Kieron


[Edited by stickleprojects on 04-02-2008 at 07:41 AM GMT]

____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

04-02-2008 at 07:25 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 991
icon Re: Printing report With excel

Oh yes.
To get more code.
Record a macro in Excel and study the code


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

04-02-2008 at 07:43 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : Printing report With excel
Next Topic (help VB6 Making layout for printing) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder