Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Error handling parameters

martijnjmartijnj Member Posts: 2
Hello all,

Admittedly, to solve this problem in an awkward way is easy (e.g. making use of a string containing the file to be opened), but I want to solve it nicely.

The problem boils down to the following.
I want to open several files consecutively.
There's a chance this fails for some of them.
In that case, a new file should be made.
If I raise an error, the event handler knows the string Err.Description.
Err.Description shows the missing file, but how can I retrieve the file name as a single string?
Using Mid() is not an option, as I get a Dutch description, but some other user probably gets it in another language.
I hope one of you guys can solve this!

Comments

  • Phat NatPhat Nat Member Posts: 757
    My thought:
    Are there any other peeriods in the Err.Description? If not, you could search for the period and then the filename before and the extension after.
  • martijnjmartijnj Member Posts: 2
    : My thought:
    : Are there any other peeriods in the Err.Description? If not, you
    : could search for the period and then the filename before and the
    : extension after.

    Thanks for answer.
    I have already solved it by introducing a temporary variable, so in an awkward way. Searching for periods is not an option, as there may be languages not using periods at all.
    To my opinion, this is a shortcoming of VB(A), as far I know most other languages would provide the file name in a separate string variable.
Sign In or Register to comment.