471,594 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

how save data in msword through vb6

suppose in vb form are more then one textbox which is contain data and i want i click command button it save in msword file and it can replace many times suppose just like we make report).

i have no experience about it i seen a exe file of vb6.
which contain a msword file in this file some label & textbox control is placed
i dont know how is it.

and when i press commnd button which is in vb6 form. its data display i msword file Label and Textbox control.

so plz help me.
and give me full process or guidliness.
or code which can i use o how to save ms word file with controls.
Mar 8 '07 #1
7 3438
Dököll
2,364 Expert 2GB
Greetings and salutations, rinku123!

You can do this in two ways:

(1) You can add data through your VB form and save as .doc. That'll give you an MS Word file (provided you have MS Office installed)

(2) You can add data through your VB form
-Built an MS Access Database
-Add data to it
-Add DataReport/Data Environment in VB
-Run a report
Again, provided you have MS Office installed

That should get you going.

I would choose choice one, just to see what happens, then go crazy and add an Access database just for fun :-)

It's exciting either way...

Dököll
Mar 9 '07 #2
anybody if can help
then plz help me.
thanks lots
Mar 10 '07 #3
plz help me soon
Mar 15 '07 #4
Dököll
2,364 Expert 2GB
Did you try option # 1?

What this means is, if you name the file being saved as myfile.doc you will ten have a document saved in word...
Mar 17 '07 #5
Dököll
2,364 Expert 2GB
Also, rinku123, you have not yet posted any of your code. Do you have anything running?

Dököll
Mar 17 '07 #6
keeaun
2
guys,

below is my code to save the data in notepad
can anyone pls teach me how to autosave cos this code there will be a pop up window for saving..
thanks a lot.

Expand|Select|Wrap|Line Numbers
  1. Dim array_data As String
  2. Dim x As Integer
  3. Dim list_array As Variant
  4.  
  5. List1.Clear
  6. array_data = "yes"
  7.  
  8. CommonDialog1.CancelError = True
  9. On Error GoTo CancelButton
  10. CommonDialog1.Filter = "Text files (*.txt|*.txt"
  11. CommonDialog1.ShowSave
  12. Newfile = CommonDialog1.FileName
  13.  
  14. Open Newfile For Output As #1
  15.  
  16. If array_data <> "" Then
  17.     ReDim Preserve received_data(Text3.Text)
  18.     For x = 0 To Text3.Text
  19.     received_data(x) = x & "," & array_data
  20.     Next x
  21.     End If
  22.  
  23. For Each list_array In received_data
  24.     Write #1, list_array
  25.     List1.AddItem List1.Text & vbCrLf & list_array
  26. Next
  27.  
  28. Close #1
  29.  
  30. CancelButton:
  31. Exit Sub
Apr 4 '07 #7
Dököll
2,364 Expert 2GB
guys,

below is my code to save the data in notepad
can anyone pls teach me how to autosave cos this code there will be a pop up window for saving..
thanks a lot.

Dim array_data As String
Dim x As Integer
Dim list_array As Variant

List1.Clear
array_data = "yes"

CommonDialog1.CancelError = True
On Error GoTo CancelButton
CommonDialog1.Filter = "Text files (*.txt|*.txt"
CommonDialog1.ShowSave
Newfile = CommonDialog1.FileName

Open Newfile For Output As #1

If array_data <> "" Then
ReDim Preserve received_data(Text3.Text)
For x = 0 To Text3.Text
received_data(x) = x & "," & array_data
Next x
End If

For Each list_array In received_data
Write #1, list_array
List1.AddItem List1.Text & vbCrLf & list_array
Next

Close #1

CancelButton:
Exit Sub
It is very likely you do not need this here:

Expand|Select|Wrap|Line Numbers
  1.  
  2. CommonDialog1.CancelError = True
  3. On Error GoTo CancelButton
  4. CommonDialog1.Filter = "Text files (*.txt|*.txt"
  5. CommonDialog1.ShowSave
  6. Newfile = CommonDialog1.FileName
  7.  
  8.  
Above deals with your dialog box, which you do not need. Could you do me a bg favour and delete the lines one by one, then run your code. I cannnot try this as of now:

(1) Delete "CommonDialog1.CancelError = True", then run code
(2) Delete "On Error GoTo CancelButton" then run code
(3) If code runs fine, delete:

CommonDialog1.Filter = "Text files (*.txt|*.txt"
CommonDialog1.ShowSave

(4) Lastly, delete "Newfile = CommonDialog1.FileName", only if pop up nop longer come up.

Anyone, please assist keeaun, I must run and cannot run this as of now. keeaun, please save this project before you do what I suggested, but I would delete the dialog data if I did not want to get a pop up before saving.

In a bit!

Dököll
Apr 7 '07 #8

Post your reply

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

Similar topics

reply views Thread by Tom Gao | last post: by
1 post views Thread by Vijay Neelam | last post: by
2 posts views Thread by Cuong.Tong | last post: by
3 posts views Thread by Bob Murdoch | last post: by
1 post views Thread by =?Utf-8?B?S2ltIFM=?= | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.