LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Converting a string to an array of integers

Duuuudes:

Is there an easy way in vba to convert a string to an array of integers. For
example:

I have this particular array of numbers in the element <column_data_types
in a xml file:

<column_data_types1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1,
1</column_data_types

I have a function that will grab the array of numbers but the function
returns a string. ("1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1") For this
particular situation I actually need this list of numbers to be numbers, not
a string, and pass them to an array in excel. Below is the situation that I'm
talking about, I am importing a query from a database and need to fill out
the .TextFileColumnDataTypes argument which takes an array of integers. I
need this to be dynamic so I put these columndatatypes in an xml file.

With WorkSheet("x").QueryTables.Add(Connection:="TEXT;" & ExcelFilePath
& "\FABRICREQ", Destination:=Range("FD_StartData"))
.Name = "FabricData"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5,
1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Instead of looking like the above: .TextFileColumnDataTypes = Array(1, 1, 1,
1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1)

it will look like this: .TextFileColumnDataTypes = Array(getXmlValue) except
getXmlValue returns a string which is the problem. Any ideas on how I should
handle this?

Any help would be appreciated.

Thanks


 
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
Stop Excel from converting integers into decimals (eg.; 12 to .12) mcwilljg Excel Discussion (Misc queries) 1 May 26th 07 03:58 AM
Stop Excel from converting integers into decimals? mcwilljg Setting up and Configuration of Excel 1 May 9th 07 07:20 PM
Populating an array from a integers values column rows [email protected] Excel Programming 1 September 28th 05 10:38 PM
Extracting integers from a text string. Bhupinder Rayat Excel Worksheet Functions 10 September 28th 05 05:15 PM
converting to Integers bmordhorst Excel Worksheet Functions 5 January 6th 05 04:55 PM


All times are GMT +1. The time now is 08:57 PM.

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

About Us

"It's about Microsoft Excel"