Reading and writing to ini files in Excel 2007

R

Rolf Gustafsson

I have thousands of Excel VBA rows created in Excel 2003 which now must be
migrated to Excel 2007. My computer has Office 2007 Professional and Vista
Business whilst my client is just about to migrate to Office 2007 but will
keep Windows XP.
My present API code for reading and writing to ini files just does not work
in Excel 2007. In fact, nothing happens.
I have spent a full day trying to find a solution on the web but without
success. My experience from Excel 2003 is that when writing to a non-existing
..ini file it will be created in the C:\Windows folder. Can anyone give useful
info about this?

It would be of great value to find a book/site or whatever info listing all
the objects/methods etc that has to be changed when migrating from Office
2003 to 2007. Is there such an info anywhere?
 
B

Bob Phillips

What API method is that Rolf?

I use GetPrivateProfileString, WritePrivateProfileString, etc. They work
fine in 2007.
 
R

Rolf Gustafsson

Bob,
After some further testing I've found that the problem is neither my code
nor Excel 2007 but Vista! In Vista (which is new to me) there is a function
"User Account Control" whose default setting is "On". Obviously it considers
"C:\Windows" a protected area whereby the ini file is not created first time
you write to it. And there is no alert informing why this is omitted. But
once the ini file is there, Vista allows it to be edited also if "User
Account Control" is enabled.
When disabling the "User Account Control" my code works fine. If you are not
familiar with this Vista "security" nonsense perhaps we both learned from my
findings.

Thanks for responding anyhow! //Rolf G
 
B

Bob Phillips

Rolf,

I have avoided Vista like the plague, and have no intention of ever loading
it. No doubt I will encounter similar nannying functionality when I
implement W7.
 

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

Top