[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB - WinWord, OLE, ActiveX or DDE

Posted on 2002-03-07
11
Medium Priority
?
644 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:ehilb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6846847
Hi ehilb,

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
0
 
LVL 14

Expert Comment

by:puranik_p
ID: 6847011
For this to work, you have to add a reference to Word library.
0
 
LVL 12

Expert Comment

by:Alfredo Luis Torres Serrano
ID: 6848203
Are you triying to open an existing document or create a new one?

Is thsi document using any kind of text from VB?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ehilb
ID: 6849849
Hi ryancys,

thanks, it runs, but how can I pass the data from vb into the corresp. textmarks in my FaxCover ?

ehilb

0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6849861
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
0
 

Author Comment

by:ehilb
ID: 6849909
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

0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6849929
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?
0
 

Author Comment

by:ehilb
ID: 6849979
yes, and to an exact position, where the corresp. textmark in Word is definied.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6850009
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
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 400 total points
ID: 6850058
Well, find an example here:

Use Microsoft Word as a Reporting Tool from Visual Basic:
http://www.freevbcode.com/ShowCode.Asp?ID=2562

Follow the Manual included.

Hope this help.
0
 

Author Comment

by:ehilb
ID: 6850187
I thank you very much !
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question