It's StrReverse(Split(StrReverse(sFullFileName), SLASH)(0))
Don't forget the (0). which is the 0'th element of the Split array.
OO methods have preceding dots in them. VB statements do not, mostly (?).
DT +++
>________________________________
> From: noskosteve <noskosteve@yahoo.com>
>To: ExcelVBA@yahoogroups.com
>Sent: Saturday, 9 June 2012, 3:34
>Subject: [ExcelVBA] ReSOLVED: Opening a CSV file and populating cells just like Excel does
>
>
>
>
>
>--- In ExcelVBA@yahoogroups.com, Derek Turner <g4swy@...> wrote:
>> Freefile gets the next available file number …people telling you that this is the proper way …
>> hard coded magic numbers.
>
>Understood. Using your own (Open as #) FileNumbers vs. the system's sequential numbers.
>
>> Close by itself will close all open files (files opened with the 'Open' statement). Close 66 does not error if #66 is already closed or never opened.
>
>That is what I am familiar with in good ol'-fashion Basic. If you saw my CAT Workbooks, I use API calls into Kenel32 and system generated handles are used.
>
>AND... from the "Once You Understand it, the Initial Guidance Makes Sense" department (:-):
>
>> Note that the keyword 'Close' is both a VBA statement and also a method in the Windows Filesystem object. Do not confuse them.
>
>Ahhhh … If I knew how to 'not confuse' them …
>
>Uh… That was the issue. After trying several different creative, OO looking syntaxes, syntaxi, syntaxum…? I worked my way to:
>
>Windows(FileNameOnly).Close
>
>Where FileNameOnly = StrReverse(Split(StrReverse(sFullFileName), "\")
>
>… And all is well in the universe. ('Windows Object' was the clue I missed). After 8-10 years playing this OO syntax starts to maker sense, sort of.
>
>Thanks profusely, Steve, K9DCI
>
>
>
>
>
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar