umm is there any1 who know how to connect microsoft office words to VB.6??

then after i wanna save the text ive type on the Words(which is connected to VB, and is running inside my form) to a database?

is this possible??

if it is , pls help me how to do it,
or links if u know some..

----------------- as much as possible i dnt wanna do this
but i dnt know how to store a data on a database that also have the same format as i type it,,

sample,

ive type something like this on Words or Notepad


XXXXXXXXX

xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxx
xxxxxxxxxxx


------ive try copy paste it on a textbox, but it only get the 1st line, i needed to store all with the same format, and when i load it on a label it will show the same..

thx for any1 who can help me...

Dani AI

Generated

As discovered, using a Rich Text control is the most practical way to keep Word-like formatting inside a VB6 form. 's Shell idea can launch Word, but saving the control's RTF stream into the database is simpler and more reliable for storing bold/italics, paragraphs and basic embedded content.

Key steps (high level) and a minimal VB6 + ADO example:

  • Use the Microsoft RichTextBox (RICHTX32) on the form; read/write the full RTF with the control's TextRTF property.
  • Store that RTF string in a long-text/blob column (Access: Memo, SQL Server: nvarchar(max) or large text type, MySQL: TEXT/MEDIUMTEXT), and use parameterized ADO commands or recordsets to avoid truncation/injection.
  • When loading, assign the database field back to RichTextBox1.TextRTF so formatting reappears.

Example (very small, assumes an open ADODB.Connection cn and docID):

' save
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT RtfContent FROM Documents WHERE ID=" & docID, cn, adOpenKeyset, adLockOptimistic
If rs.EOF Then rs.AddNew
rs!RtfContent = RichTextBox1.TextRTF
rs.Update
rs.Close

' load
rs.Open "SELECT RtfContent FROM Documents WHERE ID=" & docID, cn, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then RichTextBox1.TextRTF = rs!RtfContent
rs.Close

Troubleshooting and notes:

  • A plain Label or single-line TextBox will look like only the first line; use multiline controls or RichTextBox for display.
  • Watch encoding and size: prefer Unicode-capable columns for non-ASCII text.
  • For true Word fidelity (comments, complex OLE objects), use Word automation to SaveAs RTF/HTML and store that output, or store the document as a blob. Include RICHTX32.OCX with deployment if the RichTextBox is used.

Recommended Answers

All 2 Replies

if you want to use WORD or any application into your program,you can use the shell function.Try to search about this one.Maybe you get only the first line of what you are pasting because the maxlength is not set to be that long.

check this out:http://vb-helper.com/howto_shell_get_hwnd.html

Kuya ryan,,

ive solved the problem.

what i used is a Microsoft Rich Text Box(u can see it on the components)

then it can store anything u type and the format will be stored in a data base,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.