Microsoft KB Archive/324373

From BetaArchive Wiki

Article ID: 324373

Article Last Modified on 2/1/2007



APPLIES TO

  • Microsoft Office Word 2007
  • Microsoft Office Word 2003
  • Microsoft Word 2002 Standard Edition



This article was previously published under Q324373

SUMMARY

Microsoft Word includes two new field switches for the LINK field that are not fully documented in Word Help.

MORE INFORMATION

The following information describes the two new LINK field switches in Microsoft Word.

\u Switch

You use the \u switch when content is paste-linked as Unformatted Unicode Text.

\f Switch

The \f switch causes the linked content to update its formatting in a way that is determined by the parameter. The parameters are shown in the following table.

   Parameter  Description
   ------------------------------------------------------------------------

      0       Keep Source Formatting. This parameter is used when you are
              paste-linking text in Word documents and you select to keep
              source formatting.
  
      1       Unused. 
  
      2       Match Destination Formatting. This parameter is used when
              paste-linking in Word documents and you select to keep
              destination formatting.
  
      3       Unused.
   
      4       Keep Source Formatting and Link to Excel. This parameter is
              used when you are paste-linking content from Excel and you
              select to keep source formatting.
  
      5       Match Destination Formatting and Link to Excel. This 
              parameter is  used when you are paste-linking content from
              Excel and you select to keep destination formatting.
                

Microsoft Visual Basic for Applications Methods and Parameters for the \f Switch

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information about how to use the sample code in this article, click the following article number to view the article in the Microsoft Knowledge Base:

290140 How to run the sample code for the Office XP programs from Knowledge Base articles




The PasteAndFormat method does not allow you to specify links. Therefore, there is not a macro equivalent for the \f 0 or \f 2 LINK field switches.

\f 4: If the WordFormatting parameter value is False when you use the PasteExcelTable method, Microsoft Excel data is pasted with Excel formatting (Keep Source Formatting).

The following sample macro inserts a link to an Excel spreadsheet using the /f 4 switch. The example assumes that you have copied Excel data to the clipboard and you are running the macro against a Word document. Note that the RTF parameter indicates an HTML paste, and the WordFormatting parameter indicates that Excel formatting (Keep Source Formatting) is used.

Sub PasteExcelFormatted()

   Selection.PasteExcelTable LinkToExcel:=True, WordFormatting:=False, _
      RTF:=False

End Sub
                

This macro code inserts a field similar to the following field:

{LINK Excel.Sheet.8 "Book1" "Sheet1!R1C1:R1C3" \a \f 4 \h}


\f 5 - When you use the PasteExcelTable method, if the WordFormatting parameter value is True, Excel data is pasted with Word formatting (Match Destination Formatting).

The following sample macro inserts a link to an Excel spreadsheet using the /f 5 switch. It assumes that you have copied Excel data to the clipboard and you are running the macro against a Word document. Note that the RTF parameter indicates an HTML paste while the WordFormatting parameter indicates that the Word formatting (Match Destination Formatting) is used.

Sub PasteExcelFormatted()

   Selection.PasteExcelTable LinkToExcel:=True, WordFormatting:=True, _
      RTF:=False

End Sub
                

This macro code inserts a field similar to the following field:

{LINK Excel.Sheet.8 "Book1" "Sheet1!R1C1:R1C3" \a \f 5 \h}



Additional query words: inf

Keywords: kbhowto KB324373