View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Workbooks.Opentext - oldskool '97

Looks like it should work but doesn't for me either. When assigning an
object variable either to the workbook, or with .Sheets(1) to the sheet the
compiler doesn't seem to recognize "OpenText". Not sure why.

This kludge worked for me

call xlApp.Workbooks.OpenText(arg's etc) 'or without call and no brackets
Set mysheet2 = xlApp.activesheet

Regards,
Peter T

I'm not
"bradsalmon" wrote in message
oups.com...

Thanks for the reply Jim but that produces the same error message.

I've also tried making objwb2 a variant, and as in your example an
excel.workbook but no luck there either.

Anyone else have any ideas?

Jim Cone wrote:
Brad,
This is only a guess, try using a separate object variable for
the second workbook...

Dim objWB2 as Excel.Workbook
Dim mysheet2 as Excel.Worksheet

Set objWB2 =xlApp.Workbooks.OpenText("myfile.txt", , 1, xlDelimited,
xlTextQualifierNone, False, False, False, False, False, True, "|",
Array(1,2))
Set mysheet2 = objWB2.Sheets(1)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware