Else
WdApp.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
End If
End If
If i = 0 And (MyRecord.Fields.Item(colloop).Name = "SXH" Or MyRecord.Fields.Item(colloop).Name = "顺序号") Then
WdApp.Selection.TypeText ("序号")
Else
WdApp.Selection.TypeText (CStr(MyRecord.Fields.Item(colloop).value))
End If
If (i <> rowMax - 1 Or (i = rowMax - 1 And colloop < colMax - 1)) Then
WdApp.Selection.MoveRight (wdcell)
End If
Next
i = i + 1
MyRecord.MoveNext
Loop Until MyRecord.EOF
WdApp.ActiveDocument.SaveAs DocFileName, 0, False, "", True, "", False, False, False, False, False
WdApp.Quit
SaveAsWord = 1
Exit Function
Err_All:
Set WdApp = Nothing
SaveAsWord = -1
OutMessage = err.Description
Exit Function
End Function
好了,到此为止,我想你们对在VB中利用Word宏命令开发ASP组件,有了一些了解。只要多使用,就会很快熟悉的。