Hi
I'm trying to create a word document and put text in it. but it seems like it print the end at the beginning and the beginning at the end.
This is my example:
For this example, it prints:
3
2
1
Can anyone tell me what I'm doing wrong?
Thanks
I'm trying to create a word document and put text in it. but it seems like it print the end at the beginning and the beginning at the end.
This is my example:
Code:
Private Sub PrintTest()
Dim StringDv As DataView
Dim StringFilter As String
Dim StringDr As DataRowView
Dim wrdtest As Word.Application
wrd = New Word.Application
wrd.Visible = False
doctest = wrd.Documents.Add()
rngtest = doctest.Range()
StringDv = m_DataLayer.DsString._String.DefaultView
StringFilter = ""
StringDv.RowFilter = StringFilter
StringDv.Sort = "No"
For Each StringDr In StringDv
Select Case StringDr("No")
Case "700" '1
TopicNumberTest("1")
Case "701" '2
TopicNumberTest("2")
Case "702" '3
TopicNumberTest("3")
End Select
Next
DocTest.SaveAs(Path & "\" & "Test.doc")
wrd.Quit()
wrd = Nothing
End Sub
Private Sub TopicNumberTest(ByVal sText As String)
rngtest = doctest.Range(Start:=0, End:=0)
With rngtest
.InsertAfter(Text:=sText)
With .Font
.Name = "Arial"
.Size = 12
.Bold = True
End With
End With
End Sub
3
2
1
Can anyone tell me what I'm doing wrong?
Thanks