Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default defining TextToColumns with variable

I am trying to use TextToColumns but I want to define one of the
parameter entirely using a variable.

For example:

Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),
Array(4, 1)), _
TrailingMinusNumbers:=True

replaced with something like:

varX = "Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1))"
Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=varX, _
TrailingMinusNumbers:=True

but I cannot get this to work. Any ideas? Anything like eval() in
VBScript?

Thanks.

Edwards

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default defining TextToColumns with variable

Why not just

varX = Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1))

without the quotes?

Tim

"Edward" wrote in message oups.com...
I am trying to use TextToColumns but I want to define one of the
parameter entirely using a variable.

For example:

Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),
Array(4, 1)), _
TrailingMinusNumbers:=True

replaced with something like:

varX = "Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1))"
Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=varX, _
TrailingMinusNumbers:=True

but I cannot get this to work. Any ideas? Anything like eval() in
VBScript?

Thanks.

Edwards



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default defining TextToColumns with variable


Tim Williams wrote:
Why not just

varX = Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1))

without the quotes?

Tim

"Edward" wrote in message oups.com...
I am trying to use TextToColumns but I want to define one of the
parameter entirely using a variable.

For example:

Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),
Array(4, 1)), _
TrailingMinusNumbers:=True

replaced with something like:

varX = "Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1))"
Selection.TextToColumns Destination:=Range("A5"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=varX, _
TrailingMinusNumbers:=True

but I cannot get this to work. Any ideas? Anything like eval() in
VBScript?

Thanks.

Edwards


Thanks Tim! That did the trick.

Edward

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining a Variable Phil H[_2_] Excel Programming 3 May 22nd 06 12:04 PM
Defining a variable within a sub... aking1987[_3_] Excel Programming 1 November 11th 04 01:12 PM
Defining a variable within a sub... aking1987[_2_] Excel Programming 1 November 11th 04 12:32 PM
Defining a variable within a sub... aking1987 Excel Programming 1 November 11th 04 11:00 AM
Defining a Variable Stephen[_3_] Excel Programming 1 September 8th 03 11:33 PM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"