Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Apr 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help on developing a macro

    Hi - first post so go easy...

    I manage a specialist recruitment company and we like to present all CVs in a standard format. We are moving up from Word 2003 to Word 2010 shortly and want to see if we can automate the process of converting CVs we receive from the senders format to our format in one hit.

    In essence this means:

    selecting all text
    remove existing formatting (may need some table to text conversion first but not always - probably do this manually)
    apply house styles from a normal template
    format CV - including bringing in a company header image and footer

    Once the CV is created we can then move text around to fit

    Can anyone suggest a way of doing this in one macro? In 2003 we do it in the 4 stages mentioned but having tried this in 2010 (Trial version) we seem to hit snags

    thanks

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Most of these steps are dead simple but the real work is in working out that styles to apply to which content. You can record most of these steps to get a macro going. The basic commands I would record are:
    Ctrl-A to select all
    Ctrl-Q and Ctrl-Space to strip all local formatting
    Ctrl-Shift-N to apply Normal style to every paragraph
    Ctrl-C to copy text to clipboard
    File>New and pick your corporate template which has the headers/footers you want
    Ctrl-V to paste into the new doc.

    You might also want to add a search and replace to ensure you don't paste in a section break which would wreck your page setups and header/footer.

    You might also decide to not apply the Normal style if the CVs are typically styled reasonably.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Apr 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the reply

    yes - that will work but one thing we'd like to do is not to create a new doc, but amend the one we have to got to by the stage of File>New to bring in the company styles headers etc. The reason we want to do that is that the docs are stored on remote servers in a SaaS service database record and by opening and amending a doc from the database, means we can save it back to the correct record and then do with it what we need. It's not so easy to save it back to that remote share if we have created a new doc - it can be done but is a lot of faff an open to error.

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    In that case, the macro will need to go a bit further by attaching a template, importing the styles and replacing the header/footers (probably with autotext entries). Code for those steps might be
    Code:
    Public Sub AttachMyTemplate()
    ' Macro created by Chrysalis Design
      Dim sTempPath As String, rng as Range
      sTempPath = Options.DefaultFilePath(wdUserTemplatesPath)
      With ActiveDocument
        .UpdateStylesOnOpen = False
        .AttachedTemplate = sTempPath & "\MyTemplate.dotm"
      End With
      ActiveDocument.UpdateStyles
        Set rng = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range
        ActiveDocument.AttachedTemplate.AutoTextEntries("MyHeader").Insert _
          Where:=rng, RichText:=True
    End Sub
    Last edited by Andrew Lockton; 2011-04-20 at 21:00. Reason: added code tags
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi HelixRecruit,

    I'd probably approach the problem slightly differently, on the assumption that the existing CVs have a reasonably consistent formatting internal formatting and layout. Rather than wiping out all existing formatting, then starting over, I'd be inclined to look for paragraphs with certain attributes (eg particular words, formats), temporarily apply the 'normal' style to them, remove any extraneous formatting, then apply whatever Style the paragraphs ought to be formatted with. That way, the macro can do more of the work for you. If you simply blat all the formatting at the outset, reformatting becomes a greater challenge. Word's 'Find' function can be used to locate paragraphs of interest. Once you've got things like headings & indents sorted, the macro can clean up the remaining body text fairly easily.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    New Lounger
    Join Date
    Apr 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the advice Andrew - will give that a go and see how we get on.

  7. #7
    New Lounger
    Join Date
    Apr 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Paul

    on the assumption that the existing CVs have a reasonably consistent formatting
    oh how we wish!! we are working with candidate's original CVs here and unfortunately there is no consistency whatsoever which is why it's easier to remove all the formatting from the originals and then convert into our house style. the CVs will vary from very simple to quite complex - some of which are pains to work. of course, once we have created our "house CV" it becomes much easier then to work with them for the future - we tailor each CV profile to each job they are submitted for, so that is just making simple text changes once the reformatting is done.

Posting Permissions

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