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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ConvertToText from VBA to Vbscript 1

Status
Not open for further replies.

Lohn

Programmer
Jun 27, 2004
2
IT
I have a .vbs file that makes various operation on a excel file and then paste some text from it in Word.
Obviously the text is pasted into Word in a table and i want to convert it in simple text separated by tab.

Vba code to do that is:

Set objWD = WScript.CreateObject ("Word.Application")

objWD.Selection.Tables(1).Select
objWD.Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= True

This code doesn't work in vbscript... how can i "convert" it to use in a .vbs file? I think the problem is in the ":=" part of the code but i don't know how to fix this...

Thx in advance for your help and time ;)
 
Replace this:
objWD.Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= True
By this:
objWD.Selection.Rows.ConvertToText 1, True 'wdSeparateByTabs, NestedTables

VBScript doesn't handle named parameters, only positional.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top