Vous êtes sur la page 1sur 4

Exporting Body Text URL Links to Excel Live

Body Text is the property that contains the Rich Content for Specification objects such as Requirements, Paragraphs, and
Note objects. This content cannot be directly opened in MS Excel as a cell in an Excel Worksheet cannot hold graphics,
tables, and other rich content which can be developed in MS Word. There are occasions where a user wants to go to the
associated Body Text in MS Word from an object exported to Excel to view or modify the Rich Content in MS Word. This
can be done by exposing the URL in the Export to Excel to click on the link to open it in MS Word. This link is readily
available in a Column based export to Excel butt it is not available with a Template based export unless you do some
configuration changes.

Step One: Create the Excel Template


1. Do a General Search for the Excel Template called “REQ_default_excel_template”.
2. Expand this Excel Template then right-click the Excel Dataset
3. Select Named References…
4. Select the named reference “REQ_default_excel_template.xlsm” and click Download...
5. Save the file to your Desktop and rename it, in this case I am renaming it to “URL_REQ_default_excel_template.xlsm”
6. Open the file in MS Excel

7. Select Column I and click the Insert icon on the ribbon

8. Select cell I5 and enter the Heading “URL For Body Text”
9. Select cell I7 and enter the property reference “fnd0_body_text_url”

Note: The Requirement Revision object has the “fnd0_body_text_url” property which has the URL link in the form:
http://GTAC1:7001/tc/webclient?TC_file=rm/rmreport.html&TcObjectId=QRZRBeU_I2iyBC&TcReportFormat=WordReport
&TcReportType=ItemReport&TcExportMode=LiveBodyText&TcTemplateName=
This link will open the Body Text for the respective Specification object in MS Word

Step Two: Add a VBA Macro to the Excel Template


1. Press ALT+F11 to open the Visual Basic Editor in MS Excel
2. Expand the VBAProject for the “URL_REQ_default_excel_template.xlsm” file

3. Double-click Sheet1
Note: When using Excel Live, there are Visual Basic Events for the Excel Object model reserved by the Teamcenter
functionality such as the Open event which cannot be used for additional macro processing. In order to get an Excel
macro to run as a “pseudo-open” event, we will piggyback on one of the functionalities verification methods and start
to Post process on the Live connection using the ListBox12345. We will start processing when it loses focus.
In the Code section which just opened, add the following code:

Private Sub ListBox12345_LostFocus()

Dim htext As Range


On Error Resume Next

'Select the active, contiguous cells from I7 down the column


ActiveSheet.Range("i7", ActiveSheet.Range("i7").End(xlDown)).Select

'Convert all values in Selection to Hyperlinks


For Each htext In Selection.SpecialCells(xlCellTypeConstants, 2)
'Evaluates only URLs starting with "http..."
If Left(htext.Value, 4) = "http" Then
ActiveSheet.Hyperlinks.Add htext, htext.Value
End If
Next

End Sub

Note: This is sample VBA Code and not supported by GTAC or Development.
4. Select File…Close and Return to Microsoft Excel
5. Save this Workbook.
6. Close MS Excel

Step Three: Import the Excel Template


1. Import both of these Excel Templates in the RAC (My Teamcenter or Systems Engineering) by selecting Tools . . .
Import . . . Templates . . . Excel Template

2. Browse and select the first Excel Template


3. Click Open then Ok to commit the import
4. Repeat for the 2nd Excel Template

Step Four: Export a Structure using the Excel Template


1. Open a Requirement Specification structure in the Systems Engineering perspective
2. Select the Structure and Export to Excel
3. Select Live Integration with Excel (Interactive)
4. Select Use Excel Template and use “URL_REQ_default_excel_template”
5. Click OK

6. You will get the resulting file as follows:

URL_REQ_default_e
xcel_template.xlsm

-Gene Lawson

Vous aimerez peut-être aussi