473,395 Members | 1,537 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,395 software developers and data experts.

howto send data from vb to excel for printing

Hi
I want to send data from vb (msflexgrid) to excel . buto I dont know how .
can anyne help me?
Apr 9 '07 #1
3 1641
Killer42
8,435 Expert 8TB
Hi
I want to send data from vb (msflexgrid) to excel . buto I dont know how .
can anyne help me?
One way is to add the Microsoft Excel Object Library to the list of References in your project. Look up the documentation on the Excel object - it's quite easy to drive Excel from your VB code.
Apr 9 '07 #2
deco
8
After you added the Microsoft Excel Object Library to the list of References in your project try write this code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim xlApp As New Excel.Application
  3. Dim xlwk As New Excel.Workbook
  4.  xlApp.Interactive = True
  5.  
  6.  Set xlwk = xlApp.Workbooks.Open(App.Path & "\test.xls")  '(test.xls) file already exist in the application folder
  7.  
  8.  xlApp.Cells(1, 1) = 1982    'send the value or object or string  to excel
  9.  
  10.  xlApp.Columns.AutoFit
  11.  xlApp.Visible = True
  12.  ' xlwk.Save
  13.  ' xlApp.Quit
  14.  
Apr 9 '07 #3
Killer42
8,435 Expert 8TB
After you added the Microsoft Excel Object Library to the list of References in your project try write this code:
...
Thanks deco. I'm afraid I was being a bit lazy.
Apr 9 '07 #4

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

Similar topics

11
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert into table (rel_id, val) values (id, 5);
1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
1
by: malick | last post by:
Hello it developers, I'm using PHPExcelReader which I downloaded from sourceforge (http://sourceforge.net/projects/phpexcelreader) To read excel xls files in php. In the file reader.php (...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.