Results 1 to 15 of 15
  1. #1
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling all WordPerfect to Word Interpretors! (Word 2000)

    I recently switched from WP5.1 DOS to WP9 and now to Word 2000. I type medical reports for a living, so time is always money! With the past two programs, I had macros for the patient report headers. Each patient header would bring up a box, prompting me for information and then would insert that information into variables for specified locations in the report. In WP5.1 the variables are automatically global. In WP9 they are assigned as globals. With global variables, I could use the same patient information in other macros within the report; i.e. patient log, save macro, continue page macro. I have purchased a book and tried to educate myself, but the syntax is still a bit confusing. I am hoping that someone can take a look at my snippet below and perhaps interpret it into Word language so that I can get a feel for how it is done. I did manage to gleen a small bit of information out of the Word 2000/Que book on how to create the info box; however, the instructions stopped before the project was completed. I ended up with the box, but it did not actually input any information onto the page once I hit enter? Here is the macro for the box that I am talking about:

    Dim txtPatient As String
    txtPatient=InputBox ("Patient Name: [LAST, FIRST]", "User Information", " ")
    __________________________________________________ ________________________________
    Here is the variable assignment in WP5.1:
    {TEXT} 0~Patient Name: ~
    {VARIABLE}0~

    Here it is in WP9
    Type (Text: "Patient Name: ")
    Persist vName:=""GetString (vName;"Patient Name:")
    __________________________________________________ ________________________________
    What I am hoping to be able to do with answers to the two questions above is to create a macro that looks something like this (please disregard the ..... that I have used to keep the sample aligned).

    PATIENT'S NAME: DOE, JOHN.............................................. DATE OF EXAM: 00/00/00

    DOB: 00/00/00................................................ ...........................REFERRING: DR. NEVERDOWELL

    AGE: 105............................................... ......................................JACKET #: 00000


    ............................WHOLE BODY POSITRON EMISSION TOMOGRAPHY SCAN


    CLINICAL HISTORY: The patient........................................... ....................


    My plan is to have info boxes prompting for everything in the above header, plus an extra info box for the type of examination. I would like to assign each information box to an individual variable. Later on, I hope to create a save macro where I can use the Patient Name variable, Date of Exam variable, and Exam Procedure variable.

    I am currently using the { } and F11/shift F11 commands for the blanks. I don't really like using this long-term, as I seem to miss some of them on occasion. Also, I can't re-use this information in other vital macros. I really do miss my other macros, as I have seen a tremendous difference on the speed of my typing and getting my work finished for the day.

    I really hope that I haven't given you more information than necessary, but I am trying to be as clear as possible with the limited knowledge that I have on the terms/names of Word's variables/syntax?

    Can anyone help me with this? I would really appreciate getting a project or sample to try out on my end.

    Thanks for all of your help/suggestions.

    Atelby <IMG SRC=http://www.wopr.com/S/smile.gif>

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    <P ID="edit" class=small>(Edited by jscher2000 on 27-Jun-03 00:34. One more!)</P>Three options, at least:

    1. <LI>ASK fields. You embed these in the document itself, and then REF fields pull the information to other locations. (I don't use these, so check the online help for more information and examples.)

      <LI>strVariable = InputBox("Give me a Name"). You then can slap strVariable into a particular place in the document (Selection.TypeText or other method), or you can assign it to a document variable which persists in the document (somewhere in the invisible structural parts) and can be displayed in the document with a DOCVARIABLE field.

      <LI>A fancy dialog box (UserForm). This gives the best user experience but takes the longest to design. Sounds like it's not right for this project.
    I wouldn't be surprised of there are yet other options!

    Addendum: Mail merge; e.g., enter your data in Excel (or whatever) and merge it into your template, and then customize from there.

  4. #3
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    It sounds as if though the string variable is the way that I want to go.

    I tried typing it with "Patient" as the variable name (Sample syntax below). The results were the same, with my receiving the box prompting me for the patient's name, but nothing happening when I hit enter. Apparently I am still missing something?

    Dim txtPatient As String
    txtPatient=InputBox("PATIENT NAME: [LAST, FIRST]", "User Information", " ")
    StrVariable = Patient
    DOCVARIABLE=Patient

    Can you enlighten me further? <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

    Atelby

  5. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    If you'll post a sample document with "fields" highlighted, I (and quite possibly others as well) will post back a sample technique from which you can copy and learn. Sound good?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #5
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Hi Kevin,

    Thank you for responding to my post.

    Your suggestion sounds wonderful; however, I really don't know much about fields. From what I do know, that really isn't want I am looking for. I really would like to use global variables, as they store information in almost the same manner that the clipboard would. The great thing about the global variables is that you type the information in one time and then it is kept in memory for the other macros to draw from. The user box that I have as the first example (well, partial example) is used to prompt for the information that is assigned to the globals. Am I incorrect in the terminology that I am using? Maybe your referring to fields is the same thing as global variables? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    If you take the first sample that I gave

    Dim txtPatient As String
    txtPatient=InputBox("Patient Name: [LAST, FIRST]", "User Information", " ")
    End Sub

    and type it in as a test macro, then you will see the partial user box that I am talking about (I would really like to know how to complete this). <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    The report header sample above is what I am looking to create with the info boxes and global variables. Maybe you could give me a small sample with fields to see if that is what I am looking for?

    Please let me know if I can somehow relay this information a little more clearly; otherwise, I hope that there is someone out there that is clairvoyant? <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

    __________________________________________________ ________________________________
    Edited 06/30/03

    After looking in my Word book, I do see that DOCVARIABLES are referred to as fields (sorry for the misunderstanding on my part). I guess the fields that I need in my report sample would be PATIENT, DOE (date of exam), DOB (date of birth), MR# (medical record number), DOC (doctor), AGE, and exam. That would make six fields for this one report header. Here is the copy of the formatting from above:

    PATIENT'S NAME: DOE, JOHN.............................................. DATE OF EXAM: 00/00/00

    DOB: 00/00/00................................................ ...........................REFERRING: DR. NEVERDOWELL

    AGE: 105............................................... ......................................JACKET #: 00000


    ............................WHOLE BODY POSITRON EMISSION TOMOGRAPHY SCAN


    CLINICAL HISTORY: The patient........................................... ....................


    I don't expect you to figure this whole thing out for me, but if you could just give me an example how to complete the text box and how to input the information from the text box into a field, I would really appreciate it.

    Thanks for your help,
    Atelby <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

  7. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Gary Frieder has a very nice example of using a UserForm to collect information in <post#=269848>post 269848</post#>. You can download the sample document attached to that post and use it as a starting point. It works with custom document properties; you can define them in File | Properties.

    To display a document property in a document, insert a field of the form { DOCPROPERTY PropertyName } where PropertyName is the name of the document property. (You must not insert the field brackets yourself, type Ctrl+F9 to insert them; you can switch between field codes and field results by typing Alt+F9). Use ActiveDocument.Fields.Update to update all fields in the document (you could add this line at the end of the cmdUpdate_Click procedure in the form module.

  8. #7
    New Lounger
    Join Date
    Jan 2003
    Location
    Fort Worth, Texas, USA
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    I am also converting alot of forms from WP5.1 to Word! What a headache! If you will take the following code and plug it into a blank document with three formfields in that document, this may be how you want to go.

    Private Sub Document_New()

    'declare vars
    Dim strCaseNum, strDefName, strOffense As String

    'set name vars to inputs
    strCaseNum = InputBox("Enter the Case Number.")
    strDefName = InputBox("Enter Defendant's Name.")
    strOffense = InputBox("Enter the Offense.")

    'set field results to name vars
    ActiveDocument.FormFields("Text1").Result = strDefName
    ActiveDocument.FormFields("Text2").Result = strCaseNum
    ActiveDocument.FormFields("Text3").Result = strOffense

    End Sub

    Additionally, I have found wonderful help from these two sites:

    http://www.mvps.org/word/Tutorials/index.html
    and
    htttp://www.mousetrax.com

    Hope this will be of some help to you.

  9. #8
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Thank you Hans. I did go and look at Gary's form, but it looked completely foreign to me. I'm not sure that this is what I am looking for, as there really wasn't much instruction there to go on.

    Thank you for your help, <img src=/S/butterfly.gif border=0 alt=butterfly width=15 height=15>
    Atelby

  10. #9
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    (Edited by HansV to activate URL's - see <!help=19>Help 19<!/help>)

    Gwynne,

    Yes, yes, yes! This is what I am looking for! <img src=/S/bingo.gif border=0 alt=bingo width=15 height=22> However, when I typed the info into a test macro to try out, nothing happened after the user boxes came up prompting for the information. Am I missing something here, or is perhaps my version of Word unstable? Is there another document (excuse the terminology), or something else that your macro is normally attached to, which would make it not run on my end? Please let me know what it is that I am just not getting. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

    I have been to mousetrax before. I did print off quite a bit of information regarding sharing macros and creating user-boxes, but it is still pretty much Greek to me without a sample for me to try out. I guess I am obtuse because I need something to put into my computer to see how it actually works before I can apply it to something else?

    There was a pretty neat free booklet on Word tips at http://www.mvps.org/word/Tutorials that I downloaded.

    I'm not sure if you have been to this site yet, but it offers comparisons between WordPerfect 5.1 and Word macro language and conversions. It may help you out more than it does me at this point. http://msdn.microsoft.com/library/en-us/dn....asp?frame=true

    If you get a chance, could you please tell me where I am still going wrong? I would like to see how your sample works so that I can apply it to what I need.

    Thanks again to everyone for all of the help/suggestions.

    Atelby <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

  11. #10
    New Lounger
    Join Date
    Jan 2003
    Location
    Fort Worth, Texas, USA
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Hi Atelby,

    Sorry, I forgot to tell you that this isn't a macro. You need to create a document with the three FormFields in it, and save it as a template. Then go to Tools/Macros/Visual Basic Editor, double click on "This Document" in the Project Window and when the code window opens on the right side, place the code there. Save your VB, then save your template and close them. Click on File/New, select the template from the list, and the Input boxes will ask you questions, and plug the answers into your document. Let me know if this helps any. I purchased "Word AutoForms and Beginnign VBA eBook" from the Mousetrax site, and the author, Dian Chapman knows whereof she speaks. Another good site is http://linkURLhttp://www.dragondrop .com/WordCoding/word011a.asp

  12. #11
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    <P ID="edit" class=small>(Edited by jscher2000 on 01-Jul-03 21:54. )</P>Okay, let me go over this in more detail. There are two ways to get information to display in a document: type it there directly or use a field code to display it there from some other place that you've stored it. If the information is only going to appear once in your document, the first method is simplest. If you want the same information to appear in multiple place without the user having to retype it (and in a way that you can be sure it will remain consistent), the second method is better.

    As for HOW to do it, please see the attached sample document. It displays the test data I entered when I ran each macro. You can enter any test data you like. Please note that the document is not protected. That is, the user can completely wreck the system. This might not matter for your application. If it does, others can give advice on forms, it's not something I work with much.

    One other note: I have surrounded the InputBox calls with a Do...Loop structure. This forces the user to complete each box before moving to the next one (the user has to type a 0 in my example to "skip" the box). While you don't have to do this, if you don't, you might get empty strings.

  13. #12
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Thank you for taking the time to help me.

    I downloaded the sample, but now have to figure out where to put it to see how it functions. Your sample looks very simple, so I hope that I can figure things out from it.

    Have a great day.

    Atelby

  14. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Hi Atelby,

    In order to be able to use Jefferson's example, you need to have macro security set to Medium (recommended) or Low (see below on how to set this)

    With the document open, select Tools | Macro | Macros..., then select Demo1 in the list of macros and click Run to get prompted for new values for author, title and price.

    To see the Visual Basic code for the macro, select Tools | Macro | Macros..., then select Demo1 in the list of macros and click Edit. This will take you to the Visual Basic Editor. Alt+F11 is a shortcut to switch between Word and the Visual Basic Editor.

    It's similar for Demo2.

    To set the macro security level, select Tools | Options in Word, activate the Security tab and click the Macro Security button.

  15. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Oops, sorry, there was an error in Demo2. Please see the attached revised version. Thanks.

    (For the curious, the error was: when you delete a selection consisting of text comprising the entire contents of a bookmark, the bookmark also is deleted. My fix is to delete it and re-add the bookmark (empty) before trying to insert new data to it.)

  16. #15
    Star Lounger
    Join Date
    Jun 2003
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling all WordPerfect to Word Interpretors! (Word 2000)

    Thank you Hans and Jefferson. This is most helpful information.

    Atelby <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •