Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Aug 2018
    Thanked 0 Times in 0 Posts

    Post VB Script Needed for WordPerfect X4 Conversion to Word 2013 - AVERY LABELS.

    Good day!


    Newbie here...

    Thanks to RetiredGeek, et al, I've been somewhat successful in converting WordPerfect X4 (*.wpd) files to Word 2013 via VB batch. My need is to convert 200+ WP files that are saved as Avery labels. Is there a command line (or 2 or 16) that can be added to the script I've pasted below to specify a specific label size to insert first (with borders shown-but not printed)? I tried running the script within Word with the above label specifications pre-formatted but it didn't work. I use Avery label no. 5263. These only have the first label filled with text, not an entire sheet.

    As a bonus ... I'd also like the font set to Century Schoolbook size 13, single spaced.

    Thanks in advance for any help!!

    {Original Author: RetiredGeek}

    Option Explicit
    Sub ConvertWPtoDoc()
    ' ConvertWPtoDoc Macro
       Dim zSourceDir  As String
       Dim zDestDir    As String
       Dim zFileToCvt  As String
       Dim vFileName   As Variant
       '*** You need to provide info in each of the following 3 lines!!!
       zSourceDir = "e:\MP to MSWord"  'Path to the WordPerfect files
       zDestDir = " e:"  'Path where convertd files are stored
       zFileToCvt = Dir("e:\MP to MSWord\*.wpd")  'Get 1st Filename
       Do While zFileToCvt <> ""
          Documents.Open _
            FileName:=Chr(34) & zSourceDir & "" & zFileToCvt & Chr(34), _
            ConfirmConversions:=False, ReadOnly:=True
          vFileName = Split(zFileToCvt, ".")  'Strip file type
          ActiveDocument.SaveAs2 _
            FileName:=Chr(34) & zSourceDir & "" & vFileName(0) & ".doc" & Chr(34), _
          ActiveDocument.Close SaveChanges:=False
          zFileToCvt = Dir() 'Get Next Filename
    End Sub
    Last edited by Rick Corbett; 2018-08-09 at 12:09. Reason: Applied CODE tags to make script easier to read

  2. #2
    Super Moderator
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 471 Times in 382 Posts
    Word's VBA doesn't support the specification of a label format. In Word, labels are simply comprised of tables with particular layouts conforming to the specs for whichever label type has been chosen. Unless your source document likewise uses a table for the layout, specifying one wouldn't achieve anything anyway. Conversely, if it already has tables for the layout, they should be correct for whatever label format was specified; otherwise you'll need a macro that reformats the tables accordingly. Such a macro could only be coded by knowing in advance what changes are needed for the tables concerned.

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    darrahfc (2018-08-10)

  4. #3
    5 Star Lounger
    Join Date
    Mar 2001
    New York, NY
    Thanked 12 Times in 11 Posts
    You can do this easily without the need for a VBA macro. WordPerfect labels are pages: WP sees each individual label as a separate page. (In fact, each label can have a header and footer – something I miss in Word.)

    Open your WP labels in Word. Each label will be a page, with a next page section break between each. Using Find/Replace, you want to find a section break (^b) and replace with quotation mark, paragraph, quotation mark (“^p”).
    Add a quotation mark before the first address, and another quotation mark after the last address. Save this document as a TXT file. You will now have a data file. One last thing: at the top of the document, hit ENTER. Before the newly created blank line type “Address” (including the quotation marks). Now this is a data file where each field (named Address) is enclosed in quotation marks, and each record is separated by a paragraph mark. (Word doesn’t see the paragraph marks within each address as record delimiters because the address is enclosed in quotes.)
    Save the TXT file and close. Now use the Mailing tab to create a label merge file. Specify the TXT file as the data file to use for the merge. The field name for each label will be Address. Run the merge, and you will have Word labels.

Posting Permissions

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