well one day for about an hour and a half it was pretty slow so I decided to
give this a shot.
It is pathetic admittedly. But hey got to start somewhere.
If anyone can advise me of how to actually get this data into word please
let me know....
Private Sub FillIN()
Dim wordApp As Word.Application
wordApp = CreateObject("Word.Application")
Dim wordDoc As Word.Document
Dim wordRng As Word.Range
Dim wordPara As Word.Paragraph
Dim wordRng1 As Word.Range
Dim wordPara2 As Word.Paragraph
With WordApp
.WindowState = Word.WdWindowState.wdWindowStateMaximize
.Documents.Add()
wordApp.Visible = True
wordDoc = wordApp.ActiveDocument
wordRng = wordDoc.Range
wordRng1 = wordDoc.Range
With wordRng
.Font.Bold = True
.Font.Italic = True
.Font.Size = 14
.InsertAfter("Invoice - Customer 252991")
.InsertParagraphAfter()
End With
wordPara = wordRng.Paragraphs.Item(3)
With wordPara.Range
.Bold = False
.Italic = True
.Font.Size = 14
End With
With wordRng1
.Font.Bold = True
.Font.Italic = False
.Font.Size = 13
paragraphcount = 0
Dim i, r, c As Integer
For i = 0 To Stock11.Tables.Count - 1
'.Tables.Add(wordRng1, 1, c)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
.InsertAfter(Stock11.Tables(i).Columns(c).ColumnNa me
& vbTab)
Next
For r = 0 To Stock11.Tables(i).Rows.Count - 1
'.InsertParagraphAfter()
'.Rows.Add(r)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
.InsertAfter(Stock11.Tables(i).Rows(r).Item(c) &
vbTab)
'.InsertParagraphAfter()
Next
.InsertParagraphAfter()
paragraphcount = paragraphcount + 1
Next
Next
paragraphcount = paragraphcount + 1
.InsertAfter("Customer 252991")
.InsertParagraphAfter()
' Insert a blank paragraph between the two paragraphs.
.InsertParagraphAfter()
paragraphcount = paragraphcount + 2
wordPara2 = wordRng1.Paragraphs.Item(paragraphcount)
With wordPara2.Range
.Bold = True
.Italic = False
.Font.Size = 13
End With
End With
End With
'.ActiveDocument.SaveAs("c:\test\test.Doc")
'.ActiveDocument.Saved = True
'.Quit()
End Sub
"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:uR******************@tk2msftngp13.phx.gbl...
Hi scorpion53061, till MS rewrites OFFICE in dotnet and provides a dotnet
interface for automating, it is best to stick to VBA or compiled VB6 code
( I would prefer the latter). We do serious office integration and believe
me VB6 is the best option.