Getprivateprofilestring Crashes in Vista SP1

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a macro which works fine on Excel 2003 abut now crashes in
Excel 2007 since I upgraded Vista to SP1. It calls
Getprivateprofilestring to read an ini file several times and will
work for a few then simply crashes Excel without giving any error. It
actually seem to return the value but crash on exiting the Function
which called it. Any help gratefully received!
John
 
Could you post the relevant code?

RBS

Hi Bart
I have found the solution. It is actually do with dimming variables
not Getprivateprofilestring. I had dimmed some as
Dim icnt1,icnt2,icnt3 as integer
and prior to SP1 this worked fine but now it crashes. It seems to take
anything which is not explicitly dimmed as a variant but instead of
giving a nice wrong datatype error it crashed out. So if I put
Dim icnt1 as integer
Dim icnt2 as integer
etc it works fine.
Just another annoyance in vista!
John
 
OK, well you learned something useful there as
that is how variables should be done in any case.

RBS
 
This is not new in Vista, this is how variables are declared in VB. Perhaps
the Vista API is less forgiving of improperly declared arguments.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top