Hi, what i need is to import a txt file or a text box with numeric values, separated by tabs, into an array.
I dont want to do it by searching chr(9) and chr(10) cause this will be slow for a big matix.
I want it to run under VBA 2002 since i need to share it in the office. I've found that is quite fast to copy the text and paste it into an excel worksheet, then asign the range into a Variants Array. This will take less than one second for huge matrixes.
Anyway I don like using the clipboard or using an array of variants when a singles' or a doubles' one would do.
Any suggestion will be apreciated.
Kad
4 1778
The Split() function will easily chop up the lines at the tabs, but presumably that will produce a string array, and a 1D one, at that. Not sure how you'd go about getting it into your "matrix", which I assume is 2D.
The Split() function will easily chop up the lines at the tabs, but presumably that will produce a string array, and a 1D one, at that. Not sure how you'd go about getting it into your "matrix", which I assume is 2D.
Actually it worked great. I used split twice, with chr(10) and then with chr(9). The only problem is that i still have strings, but nothing CDbl couldnt fix, It was something like: - Dim mTemp() As String
-
Dim mEmi2() as String
-
mTemp = Split(Controls(k).Text, Chr(10))
-
For i = LBound(mTemp) To UBound(mTemp)
-
ReDim Preserve mEmi2(0 To i)
-
mEmi2(i) = Split(mTemp(i), Chr(9))
-
Next
Thank you very much Killer
Cool!
Just out of curiosity, what happens if you make mEmi2 Double instead of String? (Probably an error, but it's worth a try.)
Cool!
Just out of curiosity, what happens if you make mEmi2 Double instead of String? (Probably an error, but it's worth a try.)
Mmm, actually that code didnt work in VBA, i had to change mEmi2 to Variant, i dont know why VBA works different for jagged arrays. You aren't even able to define them with
dim array()()
That's sad, but at least i get rid of the clipboard
Sign in to post your reply or Sign up for a free account.
Similar topics
by: J. Kenney |
last post by:
Good Morning,
Is there a way for a function called within an _imported_
library to call back to _calling_ python program to run a
function? (Shown below)
Also can you overload the print...
|
by: Michael Gooding |
last post by:
I've been working on some coursework that requires the use of an excel
spreadsheet and a CSV file to be read into an ASP page and worked
with.
What I have done is set up an array to store the...
|
by: nizar.jouini |
last post by:
Hello.
I have long text file whitch is formatted like this:
nextrow4
asdf
asdf
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: Ivan Lam |
last post by:
Hi All,
Thanks for reading my question.
I am a newbie of VC .Net, and I am facing a problem about importing
DLL.
I have searched from the web and I download a simple sample. And the
code...
|
by: BeruthialsCat |
last post by:
First go with trying to import xml to a database and whilst i have
managed to do what i want i find that the xml files we have here at
work are gonna cause me problems. I have a function that...
|
by: toxicpaint |
last post by:
Hi there.
I'm doing a job in a content management system and the controlling buggers censer anything after <script so, for example, if I want to import a js file and type
<script...
|
by: rgtidwell |
last post by:
I know this code is wrong, and I am paying the price now for focusing on Linear last semester during the first half of C++, but I am trying to figure this out. Can anyone help? I want to make sure:...
|
by: kkadakia |
last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
|
by: Rahul |
last post by:
What's a good way of importing a csv text file of floats into a
Numeric array? I tried the csv module and it seems to work well so
long as I've ints. Does anyone have any suggestions / snippets...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |