ehilb
asked on
VB - WinWord, OLE, ActiveX or DDE
How can I open from VB a Word Document, for ex. a Fax Cover and pass data from VB to print using OLE, ActiveX or DDE ?
Thanks in advance
Thanks in advance
For this to work, you have to add a reference to Word library.
Are you triying to open an existing document or create a new one?
Is thsi document using any kind of text from VB?
Is thsi document using any kind of text from VB?
ASKER
Hi ryancys,
thanks, it runs, but how can I pass the data from vb into the corresp. textmarks in my FaxCover ?
ehilb
thanks, it runs, but how can I pass the data from vb into the corresp. textmarks in my FaxCover ?
ehilb
Hi ehilb,
I think it's depends on your Fax Application you used. FaxCover may integrates with the M$ Word, check the user manual or any useful references to see whether FaxCover support word integration or not.
Anyway, i use the Symantec Winfax Pro before and it's able to print word documents to fax.
if feel free, you can suft at: http://www.symantec.com/winfax/
and FYI, i tried to use the M$ Word Mail Merge Documents and Integrate with Winfax Pro before but i haven't success in that way.
regards
I think it's depends on your Fax Application you used. FaxCover may integrates with the M$ Word, check the user manual or any useful references to see whether FaxCover support word integration or not.
Anyway, i use the Symantec Winfax Pro before and it's able to print word documents to fax.
if feel free, you can suft at: http://www.symantec.com/winfax/
and FYI, i tried to use the M$ Word Mail Merge Documents and Integrate with Winfax Pro before but i haven't success in that way.
regards
ASKER
Hi ryancys,
my FaxCover.doc is a normal .doc, where I have some Textmarks in it, for example FaxNo., Ref.:, & s.o.
I try with this code, but it doesn't work:
...
...
InsertText "ToName", Text1.Text
InsertText "ToFaxNum", Text2.Text
InsertText "ToPhoneNum", Text3.Text
...
Public Sub InsertText(ByVal Position As String, ByVal Text As String)
With Form1
' Position the insertion point in Word
.lblDDE.LinkExecute "[EditGoto .Destination = " & Chr$(34) & Position & Chr$(34) & "]"
' Insert the Text
.lblDDE.LinkExecute "[Insert " & Chr$(34) & Text & Chr$(34) & "]"
End With
End Sub
....
I get the Runtime error 285. Word can't execute the DDE-Methode.
regards
ehilb
my FaxCover.doc is a normal .doc, where I have some Textmarks in it, for example FaxNo., Ref.:, & s.o.
I try with this code, but it doesn't work:
...
...
InsertText "ToName", Text1.Text
InsertText "ToFaxNum", Text2.Text
InsertText "ToPhoneNum", Text3.Text
...
Public Sub InsertText(ByVal Position As String, ByVal Text As String)
With Form1
' Position the insertion point in Word
.lblDDE.LinkExecute "[EditGoto .Destination = " & Chr$(34) & Position & Chr$(34) & "]"
' Insert the Text
.lblDDE.LinkExecute "[Insert " & Chr$(34) & Text & Chr$(34) & "]"
End With
End Sub
....
I get the Runtime error 285. Word can't execute the DDE-Methode.
regards
ehilb
Hi,
Not very clear, and i never use DDE method before, so what you want to do is pass the Data (example Form1.Text1.Text) to a Word Doc?
Not very clear, and i never use DDE method before, so what you want to do is pass the Data (example Form1.Text1.Text) to a Word Doc?
ASKER
yes, and to an exact position, where the corresp. textmark in Word is definied.
Hi,
Can you send me the Word Doc template as well as what have you done so far? I want to take a look its structure.
And may reply after this weekend. You can get my email at my profile.
Another question: Are you connect to a Database or just want to insert free text in certain area in Word Doc?
regards,
ryancys
Can you send me the Word Doc template as well as what have you done so far? I want to take a look its structure.
And may reply after this weekend. You can get my email at my profile.
Another question: Are you connect to a Database or just want to insert free text in certain area in Word Doc?
regards,
ryancys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I thank you very much !
Try this (Word Automation):
Private Sub Command1_Click() 'Print Word Doc
Dim iWord As Word.Application
Set iWord = New Word.Application
iWord.Documents.Open Text1.Text
iWord.PrintOut
iWord.Documents(1).Close False
iWord.Quit
Set iWord = Nothing
End Sub
Hope this help