Dim QCConnection As TDConnection
Dim Test As Test
Dim TestFactory As TestFactory
Dim TestList
Dim StepFactory As DesignStepFactory
Dim Step As DesignStep
Dim StepList
Dim str As String
Dim documentName As String
Dim wordApp As Word.Application
documentName = "软件测试说明.doc"
Dim conn As adodb.Connection
Dim strConnect As String
Dim rs As New adodb.Recordset
Dim strSql As String
Set wordApp = CreateObject("Word.Application")
'使文档可见 0不可见
wordApp.Application.Visible = 0
Dim myDoc As Word.Document
Set myDoc = wordApp.Documents.Add() '页面
With wordApp
Set QCConnection = New TDAPIOLELib.TDConnection
QCConnection.InitConnectionEx "http://XXXXXXX/qcbin"
QCConnection.ConnectProjectEx "DEFAULT", "XXXXXXX", "XXXXXXX", "XXXXXXX"
Set TestFactory = QCConnection.TestFactory
For Each Test In TestList
.Selection.Font.name = "黑体"
.Selection.Font.Size = 16
.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Selection.TypeText Text:="测试用例设计单"
.Selection.EndKey Unit:=wdStory
Set StepFactory = Test.DesignStepFactory
Set StepList = StepFactory.NewList("")
Set mytable = .ActiveDocument.Tables.Add(.Selection.Range, StepList.Count + 13, 5)
With .Selection.Tables(1)
If .Style <> "网格型" Then
.Style = "网格型"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With