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

Export to Word file from listview in vb6

137 100+
hi all,
i am using vb6 and a listview to display all the records of students.

now i want all the details of each student to be exported in word file.
i exported in a single column. but i wanted to get it in a matrix form. i mean to say three students in each row and then continue.
i mean to say in the following format:
student1 student2 student3
add1 add2 add3
email1 email2 email3

student4 student5 student6
add4 .......... ...............
...........
and so on....


how to do this
i just did one in a row
plz could anybody kindly help me to format the word file as i needed???
with regards,
Jun 17 '08 #1
1 5826
kadghar
1,295 Expert 1GB
Well, the easiest way to learn how to use Word's VBA is recording a macro in word. then you can copy-paste the code to VB6

just a few tips: always refer to the object before any property or method of Word's VBA. And replace the word and ofice constants with its numeric value:

eg.

lets say you recorded:

Expand|Select|Wrap|Line Numbers
  1. Sub Macro1()
  2. '
  3. ' Macro1 Macro
  4. ' Macro grabada el 18/06/2008 por XXXXX
  5. '
  6.     Selection.TypeText Text:="Hello World"
  7.     Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
  8.     Selection.Font.Bold = wdToggle
  9.     If Selection.Font.Underline = wdUnderlineNone Then
  10.         Selection.Font.Underline = wdUnderlineSingle
  11.     Else
  12.         Selection.Font.Underline = wdUnderlineNone
  13.     End If
  14. End Sub
  15.  
To use it in VB6 you'll need something like

Expand|Select|Wrap|Line Numbers
  1. Sub WORDHelloWorld()
  2.     Dim Obj1 As Object
  3.     Set Obj1 = CreateObject("word.application")
  4.     Obj1.Visible = True
  5.     Obj1.Documents.Add
  6.     With Obj1
  7.         .Selection.TypeText Text:="Hello World"
  8.         .Selection.HomeKey Unit:=5, Extend:=1
  9.         .Selection.Font.Bold = 9999998
  10.         If .Selection.Font.Underline = 0 Then
  11.             .Selection.Font.Underline = 1
  12.         Else
  13.             .Selection.Font.Underline = 0
  14.         End If
  15.     End With
  16. End Sub
Well, HTH
Jun 18 '08 #2

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

Similar topics

5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
4
by: Paolo | last post by:
Hello, I am trying to create a procedure to export my Access data to a word template. I would like to export data from two tables to a word file at the same time. My two tables are named CASES...
1
by: Bridget Willey | last post by:
I am using ACT 6 and am trying to "split" the database between records for customers and junk records. The accounts designated as "customers" have that word in the ID field, and I am using that...
2
by: PerryC | last post by:
Is there a way to export an MS Access Report to Word/Excel that looks EXACTLY like it appears in Access? When I export to Excel, only certain data appears, titles, headings... all missing. The...
1
by: John Smith | last post by:
Does anybody have some sample code to Export a string to a Word Document? I want to have a form that a user populates data with. Then the user clicks a "Submit" button. The data populates a...
1
by: sb Luis | last post by:
Hi everyone, I am going to export content of Rich text into MS WORD (.doc file) in a window application. thanks. Sb. Luis.
0
by: d_mike_2004 | last post by:
Hi, I have a web form, which display data from a Database. I'd like to find out how to export data from webform (eg. DataSet) to an RTF file. Would it possible to create tables in RTF as in...
7
by: Vanessa | last post by:
hi Everyone, I have two questions on exporting data to Excel using ASP (w/o converting formatted excel file into web page and then plug in the dynamic data): 1. Can we export data into...
0
by: coolminded | last post by:
hi all i have to export the value of grid from vb to word. i just exported all the grid value to word. but what i want is i just want to export the value of grid one by one. that means when i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.