WD2002: Additional LINK Field Switches in Word 2002 (324373)



The information in this article applies to:

  • Microsoft Word 2002

This article was previously published under Q324373

SUMMARY

Microsoft Word 2002 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 2002.

\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.
				
For more information about the LINK field, click Microsoft Word Help on the Help menu, type Field codes: Link field in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

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 article number below to view the article in the Microsoft Knowledge Base:

290140 OFFXP: How to Run Sample Code 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. For more information about the PasteAndFormat method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type PasteAndFormat in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

\f 4 - When you use the PasteExcelTable method, if the WordFormatting parameter value is False, 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:

{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:

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

For more information about the PasteExcelTable method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type PasteExcelTable in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbhowto KB324373