M
mike
Hi. I have some code that takes my Access data and creates
a table in a Word doc but I'm not sure how to sort the
columns programatically. Any suggestions would be great.
Here's my code:
Dim strTableTransfersOut As String
Dim objTableTransfersOut As Word.Table
strTableTransfersOut = "From Territory" & vbTab & "From
TM" & vbTab & "Account Number" & vbTab & "Account Name" &
vbTab & "To Territory" & vbTab & "To TM" & vbTab & "Date"
& vbCr
If Not recTransfersOut.EOF Then
Do While Not recTransfersOut.EOF
strTableTransfersOut = strTableTransfersOut &
recTransfersOut("FROMTerritory") & vbTab & recTransfersOut
("FROMTM") & vbTab & recTransfersOut("AccountNumber") &
vbTab & recTransfersOut("AccountName") & vbTab &
recTransfersOut("TOTerritory") & vbTab & recTransfersOut
("TOTM") & vbTab & recTransfersOut("EffectiveDate") & vbCr
recTransfersOut.MoveNext
Loop
End If
InsertTextAtBookmark "TransfersOut", strTableTransfersOut
Set objTableTransfersOut =
m_objWord.Selection.ConvertToTable(Separator:=vbTab)
objTableTransfersOut.AutoFormat
Format:=wdTableFormatGrid8, AutoFit:=True,
ApplyShading:=True
Set objTableTransfersOut = Nothing
a table in a Word doc but I'm not sure how to sort the
columns programatically. Any suggestions would be great.
Here's my code:
Dim strTableTransfersOut As String
Dim objTableTransfersOut As Word.Table
strTableTransfersOut = "From Territory" & vbTab & "From
TM" & vbTab & "Account Number" & vbTab & "Account Name" &
vbTab & "To Territory" & vbTab & "To TM" & vbTab & "Date"
& vbCr
If Not recTransfersOut.EOF Then
Do While Not recTransfersOut.EOF
strTableTransfersOut = strTableTransfersOut &
recTransfersOut("FROMTerritory") & vbTab & recTransfersOut
("FROMTM") & vbTab & recTransfersOut("AccountNumber") &
vbTab & recTransfersOut("AccountName") & vbTab &
recTransfersOut("TOTerritory") & vbTab & recTransfersOut
("TOTM") & vbTab & recTransfersOut("EffectiveDate") & vbCr
recTransfersOut.MoveNext
Loop
End If
InsertTextAtBookmark "TransfersOut", strTableTransfersOut
Set objTableTransfersOut =
m_objWord.Selection.ConvertToTable(Separator:=vbTab)
objTableTransfersOut.AutoFormat
Format:=wdTableFormatGrid8, AutoFit:=True,
ApplyShading:=True
Set objTableTransfersOut = Nothing