Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Template Organizer (Word 2003)

    The "Open File" dialogue boxes in the Templates and Add-ins Organizer always start in the default templates folder, with "Files of type" = *.dot . Is it possible (macro?) to make them start in the same folder as the current document, with "Files of type" = *.doc (or *.*)? Alternatively, is there another easy way to copy all the styles from one document to another in the current folder?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Template Organizer (Word 2003)

    Try this:

    Sub CopyStyles()
    Dim strPath As String
    Dim strSrc As String
    Dim strTrg As String
    Dim doc As Document
    strPath = ActiveDocument.Path
    If Not Right(strPath, 1) = "" Then
    strPath = strPath & ""
    End If
    With Application.FileDialog(msoFileDialogOpen)
    .Filters.Clear
    .Filters.Add "Word documents (*.doc)", "*.doc"
    .InitialFileName = strPath & "*.doc"
    .Title = "Select source document"
    If .Show = True Then
    strSrc = .SelectedItems(1)
    Else
    Exit Sub
    End If
    .Title = "Select destination document"
    If .Show = True Then
    strTrg = .SelectedItems(1)
    Set doc = Documents.Open(strTrg)
    Else
    Exit Sub
    End If
    End With
    doc.CopyStylesFromTemplate strSrc
    End Sub

    I haven't stress-tested it, so try it out on copies of documents first!

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Re: Template Organizer (Word 2003)

    That seems to work OK, thank you.

    In the Open File dialogue box, "File name" = blank and "Files of type" = "Word documents (*.doc) (*.doc)" - is that correct?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Template Organizer (Word 2003)

    The file name is for the user to select.
    To avoid the double (*.doc), you can change

    .Filters.Add "Word documents (*.doc)", "*.doc"

    to

    .Filters.Add "Word documents", "*.doc"

  5. #5
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Re: Template Organizer (Word 2003)

    OK, thank you.

Posting Permissions

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