Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with MS Word VBS

Status
Not open for further replies.

jimdurand

Technical User
Jan 20, 2010
4
AU
Hello all, I am a newbie to manipulating Word model with VBS. I am trying to do something in VBS that I can do in VBA.
I am converting a table to text (in a Word doc) using the converToText method.
I have everything working except I can't specify the Seperator type in VBS.

This works, but doesn't separate:
Set objTable = objDoc.Tables(1)
objTable.Rows.ConvertToText (or objTable.ConvertToText)

VBA does this:
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= True

This doesn't work:
Set objTable = objDoc.Tables(1)
objTable.Rows.ConvertToText Separator:=wdSeparateByTabs, _ NestedTables:= True

I have tried the MSDN methods and they don't seem to work either.

I hate quitting,but I'm at my wits end!
Thanks in advance

Jim
 
I can't believe it was something so simple after wasting 4 hours on this.

I just had to find the Constant

const wdSeparateByTabs = 1

Set objTable = objDoc.Tables(1)

with objTable
.Rows.ConvertToText wdSeparateByTabs, True
end with

I have attached the page where you can find all the Word Constants for anyone who is interested
 
 http://msdn.microsoft.com/en-us/library/aa211923(office.11).aspx
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top