Pass string as Parameter in OpenText method

G

Guest

Hi Folks
I am trying to import data from text file to
excel using OpenText method. It works fine . Can i pass a
string contains list of fields to be imported and thir
data type.

Workbooks.OpenText
FileName:="C:\ips\ips.txt", Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array
(Array(1, 2))

What i mean is
StrCode = "Array(Array(1,2))"

Workbooks.OpenText FileName:="C:\ips\ips.txt",
Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:= StrCode

Here i assign FieldInfo to variable strCode.

If u have any soultion please let me know.

Thanks & Regards
Niraj
 

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