Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2007
    Thanked 0 Times in 0 Posts

    Setting the 'save as' name, from text in a table (WORD 2003)

    Hello All,

    Re: Setting the "save as" name, from text in a table

    I have a need to pickup and use text which is sitting in a table, within a Word docs header

    The Header contains a two column, three row table

    The first column has the following text
    Commodity Code:
    Commodity Description:
    Recipe Code:

    I need to produce a Macro/VBA code to enable the word document to be saved as the "Commodity Code:", i.e. The text which resides in the second column, first row.

    Is this possible?

    I have tried to record a macro to do this, but I am not having any luck.

    Any help would be appreciated.

    Many Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Setting the 'save as' name, from text in a table (WORD 2003)

    Try this:
    Sub SetSaveAsName()
    Dim strTitle As String
    strTitle = ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary). _
    Range.Tables(1).Cell(1, 2).Range.Text
    strTitle = Left(strTitle, Len(strTitle) - 2)
    With Dialogs(wdDialogFileSummaryInfo)
    .Title = strTitle
    End With
    End Sub
    The method for setting the Save As name is from How to set the default suggested filename to be displayed by the Save As dialog the first time a user saves a new document.

Posting Permissions

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