Output Array

J

John Bundy

Thanks for looking

I work with Excel a lot and have built an array of string values, there are
about 200 in the test. I am trying to output these to word using code found
here, I'm getting no errors but nothing is happening either. Thanks for any
help and the code is below

Set owordapp = CreateObject("Word.Application")

'open a new document in Word
owordapp.Documents.Add DocumentType:=wdNewBlankDocument
owordapp.Visible = True

storeIndex = 1
'===THIS IS THE PROBLEM==========
Do Until storeArray(storeIndex, 16) = ""
activedocument.Range.insertafter storeArray(storeIndex, 16) & vbCrLf
activedocument.Range.insertafter storeArray(storeIndex, 17) & vbCrLf
storeIndex = storeIndex + 1
Loop

Probably something easy but I'm lost in Word
 
J

John Bundy

Found some help that worked from Excel side, for those looking this is what I
did

Set owordapp = CreateObject("Word.Application")

'open a new document in Word
owordapp.Documents.Add DocumentType:=0

owordapp.Visible = True
storeIndex = 1

Do Until storeArray(storeIndex, 16) = ""
owordapp.Selection.TypeText storeArray(storeIndex, 16) & vbCrLf
storeIndex = storeIndex + 1
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top