Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HOW TO AUTOMATE A FAX FORM

Posted on 1999-06-29
6
Medium Priority
?
183 Views
Last Modified: 2010-05-02
I`ve got a fax form that needs to be automatically filled in
i want 6 textboxes that put the filled in info on certain locations on the faxform the faxform is a word document
how do i specify the locations in the form where the info
has to be filled in
5 textboxes are to get info about sender company city faxnumber and address the 6th one has to put the desired text for what`s needed on the fax on to the form
please reply to this question
0
Comment
Question by:GOPPIE
[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
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 1520686
GOPPIE,

I'm afraid I don't have the answer for you but rest assured, someone will, and usually it will appear pretty soon. You don't need to give us an extra prod by asking us to please reply and by putting the question IN CAPITALS. There are quite a few very good VB experts here and they are all eager to help. The 180 points you put up are also very generous so that will help ;-)
0
 
LVL 4

Accepted Solution

by:
RichW earned 540 total points
ID: 1520687
Set a reference to Microsoft Word 8.0 Object Library

Use VBA to transfer the values.  

Set up Bookmarks in a Word 97 template doc. (.dot)  Example:

Bookmark in the position you want the "Company" variable to place.  Name the Bookmark mrkCompanyName.  Also have text in the bookmark as mrkCompanyName.

Next, open a Word object in VB.  
Example:

Dim sTemplateName
 
sTemplate = MyTemplateDoc.dot

  Set objWord = CreateObject("word.application")
  objWord.Documents.Open CurDir() &  sTemplateName

The next thing you want to do is set the variables for the text fields:

getCompanyName = frmMain.txtCompany.text
getFax = frmMain.txtFax.text

etc., etc.

Next, you're going to do a Find/Replace using the Bookmark you made in the Word template.

Example:

With objWord.Selection.Find
    .ClearFormatting
    .Text = "mrkCompany"
    .Replacement.ClearFormatting
    .Replacement.Text = getCompanyName
    .Execute Replace:=wdReplaceAll, Forward:=True,        Wrap:=wdFindContinue
  End With

Repeat this for all the text fields you wish to pass.

Figure out how to handle the nulls using simple If statements like when to pass a second address line and when not to.

Next you have to print and close the document.

DoEvents
    objWord.Application.PrintOut
    objWord.ActiveDocument.Close savechanges:=wdDoNotSaveChanges

Next, Quit and set to Nothing

objWord.Application.Quit savechanges:=wdDoNotSaveChanges
    Set objWord = Nothing

You do not want to save the changes.  This way you can keep the template clean for future prints.

Before the close you may want to set a MsgBox to let the user know it's spooling to the printer.

That's about it.  Let me know if you need help with it.

Good Luck

Rich

0
 
LVL 4

Expert Comment

by:RichW
ID: 1520688
One change to what I posted earlier.  In the replace/Find section, change mrkCompany to mrkCompanyName or whatever you named the bookmark to match.
0
Independent Software Vendors: 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:GOPPIE
ID: 1520689
Thank you very much
I`ll try to make this work
if i have some more questions can i mail them to you???
that is because i don`t have any more points to award you
is it that i can only get points by solving other people problems or can i upgrade my points in some menu?
this i ask because i`m very new to this type of help
my email address is erik_goppel@yahoo.com
please reply this message with your email address so we can exchange some info
i know some about c++ and visual c++ and study electronics
so maybe i can help you with that
well i`m going to try your info now
i`ll be waitng for your reply
thank you


erik
0
 

Author Comment

by:GOPPIE
ID: 1520690
i`ve still got a question
i still keep getting this error message "object required"
i have tried evereything possible but i just gut stuck
could you please help me some more i`ll send the fax file to you including the template
if you`d please give me your email adress so i can get on with my work
0
 
LVL 4

Expert Comment

by:RichW
ID: 1520691
You either didn't open the object in runtime properly, or you forgot to set the Reference for Microsoft Word 97 Object Library.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

660 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