473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Need help with generating an excel document using VB

Hi


I'm trying to generate an excel document using visual basic? I can preview the report fine but the users want me to generate the report to mirror an excel sheet and export.

I was browsing the net but can't find anything relevant except for 'DoCmd.OutputTo acOutputReport, "name of report", acFormatRTF, , True
which generates the data in a word document.


If anyone has any ideas I'd appreciate it.


Thanks


Anita
Sep 13 '07 #1
2 1162
kadghar
1,295 Expert 1GB
Hi


I'm trying to generate an excel document using visual basic? I can preview the report fine but the users want me to generate the report to mirror an excel sheet and export.

I was browsing the net but can't find anything relevant except for 'DoCmd.OutputTo acOutputReport, "name of report", acFormatRTF, , True
which generates the data in a word document.


If anyone has any ideas I'd appreciate it.


Thanks


Anita
create an object with an excel application in it, then add to it anything you want

something like:

Expand|Select|Wrap|Line Numbers
  1. dim obj1 as object
  2. set obj1 = createobject("excel.application")
  3. obj1.visible=true
  4. obj1.workbooks.add
Then you can add to it anything you want:

like

Expand|Select|Wrap|Line Numbers
  1. obj1.cells(1,1).value = "hello world"
or if you have an array with 10 elements, you can do:

Expand|Select|Wrap|Line Numbers
  1. with obj1.workbooks(1).worksheets(1)
  2.     .range(.cells(1,1), .cells(1,10))= myarray
  3. end with
hope that helps
Sep 13 '07 #2
It's exactly what I needed and it's worked perfectly.


Thanks very much for the help


Anita
Sep 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Pawel | last post by:
Hello All I tried to embed Excel sheet into HTML page by following command: <iframe src="Tmp.XLS" width="100%" height="500"></iframe> and it works, showing Excel sheet inside the page, but...
5
by: Rimantas Žukaitis | last post by:
Hi, we are developing server side report generation application with .NET. The problem is, that we have to present same data in diferent formats (HTML, PDF, WORD, EXCEL). This has to be done...
0
by: Raghavendra | last post by:
hi, we r using forms authetication. problem :- i am using the below code to generate excel report but since we r using forms authetication.. after generating excel report the browser directs...
4
by: Lisa | last post by:
Hi - I'm able to open excel workbooks and word documents, but I can't seem to copy excel charts, named ranges, etc. to a word document. Anyone know of good reference material in this area? What...
0
by: Adrian Belen via .NET 247 | last post by:
hi, I have a problem when I try to open an excel document in a AxWebBrowser Component in VB.NET. The problem appear in this situation: Before to all the Excel application is opened from the...
2
by: lxrocks | last post by:
Hi I have always downloaded table data to excel using a perl_cgi. The perl cgi will simpley print("Content-Type: application/vnd.ms-excel"); followed by the usual html table formatted data. ...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
1
vinci
by: vinci | last post by:
Please help me out... i only have two weeks to do it... here is my code: Dim ex As New Object Dim wb As Excel.Workbook Dim sheet As Excel.Worksheet
4
by: stephen | last post by:
Hi all, I am working with Excel. I read an excel document using ExcelReader and lets say it has 10 columns. I have to read each record and based on a specified column peform some activites and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.