Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Macro to move table title above table itself

    Hello,


    I have a large number of MS Word documents that were converted to MS Word from Adobe FrameMaker 9. Everything is good except that my table titles all came in below the each table and I would like to somehow run a macro (if possible) that will:

    1. Point to a folder full of MS Word documents (.doc) on my "C" drive (e.g. C:\Temp).
    2. Find the Table Title style.
    3. Move the Table Title style to table right above it.

    Does anyone know if this is possible? It will save a lot of manual work for sure.

    Thanks for any assistance you can provide.
    I am using MS Word 2010 and using the .DOC format.

    Regards,

    -J

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Hi James,

    (still getting used to this new software - didn't notice your post until now!)

    • Do the table titles literally have a style called 'Table Title' applied to them? (or are they perhaps captions?)
    • Are the table titles always the very next paragraph after the table they pertain to, or can they be some variable number of paragraphs below the table above?
    • Can you post a short sample document?

    Gary

  3. #3
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi Gary,

    Thanks for your reply and sorry for the delay in replying. I have been busy with some pressing projects, but not have a little time to revisit this. This issue is actually affecting my figure titles too, but the figure title is under the graphic, where I want it. With both the Figure Title and Table Title styles, the formating (in FrameMaker was: Figure 1-1 or Table 1-1. When I save the FrameMaker file out to MS Word as an RTF (option available) and bring it into MS Word, the Figure Title now reads: Figure°1□1 or Table°1□1

    So, what I am hoping to do is to find a macro that will:

    1. Point to a folder full of MS Word .DOC files (as I resaved the RTFs to .DOC)
    2. Find Figure Title style Figure°1□1 and Table Title style Table°1□1 and change to: Figure 1-1 and Table 1-1
    3. Find any placement of the Table Title style under an actual Table and then move that style to above the table.
    4. Save changes in each MS Word .DOC file

    This will save me from having to do a lot of manual rework.

    Thanks for any suggestions. Perhaps I can find a way to move the Table Title style above actual tables by recording a macro, doing exactly what I described and then studying the macro coding afterwards. What do you think?

    Thanks in advance for any suggestions.

    Regards,

    James

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    James,

    Would it be possible to post a short sample document (if necessary, just a short sanitized snippet) including a couple of examples of each type of caption, and a couple of tables? - that would make it easier to work out a code fix for this situation.

    Gary

  5. #5
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Macro to move table title above table

    Hi Gary,

    Thanks for the reply. Here is a sample document that was saved out of FrameMaker to RTF. Then I saved the RTF file (using MS Word 2010) to a .DOC file. The thing I am trying to do again is:

    Have a macro created that will point to a folder full of MS Word (.DOC) documents (e.g. C:\Temp) and then find each reference to:

    Figure°1□1

    and

    Table°1□1

    and rename it to: Figure 1-1 and Table 1-1

    Also, my Figure Title are sitting under each graphic as I prefer it, but for some reason during the FrameMaker (.FM) to RTF conversion, each table title got placed under the table, instead of above the table, where I prefer it. So, I am looking for a macro to fix that too.

    Any ideas and suggestions are appreciated. I have been experimenting with recording macros, but nothing is working yet.

    Thanks,

    James
    Attached Files Attached Files

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    James,

    Posting the document is definitely helpful in terms of seeing the scope of the issue. There are structural problems with the way these documents are coming from Framemaker to Word, that will require more thorough interventions than just getting rid of the square boxes and moving the location of the table titles.

    First off, based on your description, I figured we would be dealing with Captions in the Word document, but the objects that have come across in the document are not Captions, nor are they any kind of recognizable Word field. They look like gray Word fields, but if you select one and do this in the Immediate Window: ?Selection.Fields.Count - you get a 0. Similarly, selecting these and doing an F9 (Update) does nothing. And these don't respond to toggling the field code view.

    While you could fix the location of these objects, and maybe figure out how to replace the square boxes with hyphens, it doesn't make much sense to retain these in the Word document, because they will never function as proper Word captions - for example if you delete one of the tables, there will be no way to update the caption numbering.

    Another structural issue that will need to be dealt with is the heading numbering: that first heading, that is numbered 8.2, is not a functioning Word autonumber - it's actually a bullet. (So if you copy that heading and paste it a couple of times, all of the headings will still be numbered 8.2. - same thing by the way with the subparagraph numbered "1)")

    And the style associated with that heading is called "Heading1" - as opposed to the built-in Word style "Heading 1" - which is what you'll need to use for numbered chapter headings if you want to have caption numbering like "8-1".

    It looks to me that you can't just use an RTF created out of FrameMaker, without doing a lot more further conversion, in order to end up with a properly functioning Word document.

    About 15 years ago, I did a large FrameMaker to Word conversion project, and although these were much earlier versions of both applications, what we did then may still be relevant to what you're doing now: First I documented all the FrameMaker styles and mapped these names to the equivalent (custom) styles we were going to use in Word. Then I built a style set in a FrameMaker template that used Framemaker's numbering feature to associate specific token strings with each mapped FrameMaker style. By applying that style set to each FrameMaker document to be converted, the result was that every paragraph was prepended with a specific token strong.
    Next we opened each FrameMaker document manually, copied the text, and did a Paste Special > Unformatted Text into a new Word document. A cleanup macro was then run on the Word document that looked for the token strings, applied the appropriate Word style, and then deleted the token strings.
    (The process probably could have been automated even more, but I was a newbie programmer at the time!)

    Much shorter version: I think these documents are going to need a more thorough conversion, than what you already have in place, in order to function properly in Word.

    Gary

  7. #7
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hello Gary,

    Thank you very much for the detailed explanation. I really appreciate it.
    My ideal scenario would be to have my software developers write technical snippets in MS Word (something that everyone has on their computer - unlike FrameMaker). The MS Word file or template would be a protected MS Word .DOT file. You know, if you double click on the MS Word .DOT file from Windows Explorer, it opens a fresh .DOC file that is protected (limited to a handful of styles) and ready to be used (versus right clicking on the .DOT file to open the template itself). I would then take the tech pieces and updates from time to time and import them into FrameMaker 10, where the FrameMaker styles would match the MS Word styles (one for one). But, I guess, it is not an easy task to take any optimized files I have developed in FrameMaker and convert them back into .DOC files, unless of course I saved out to MIF first (or .TXT) but there are consequences for doing that...

    Well, I do appreciate your insights and I will see what I can do, going forward.

    Thanks again for your detailed response.

    James

Posting Permissions

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