PC Review


Reply
Thread Tools Rate Thread

Best way to use INI file

 
 
M. Authement
Guest
Posts: n/a
 
      3rd Dec 2006
I am developing an add-in and am using an INI file to store various options
and lists. My question is this: am I better off reading the INI file into a
worksheet as part of the Workbook_Open event (and therefore having only 1
call to the INI file) or just call the INI file as needed? I have a class
module that defines all of the INI reads/writes, so the code is no problem.
Just wondering if there are advantages/disadvantages to the two methods.
TIA.


Using WinXP and XL2003.


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      3rd Dec 2006
I would create a class object and read the INI file and store as properties
of the class.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
"M. Authement" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am developing an add-in and am using an INI file to store various options
>and lists. My question is this: am I better off reading the INI file into
>a worksheet as part of the Workbook_Open event (and therefore having only 1
>call to the INI file) or just call the INI file as needed? I have a class
>module that defines all of the INI reads/writes, so the code is no problem.
>Just wondering if there are advantages/disadvantages to the two methods.
>TIA.
>
>
> Using WinXP and XL2003.
>



 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      3rd Dec 2006
Sounds like the only consideration is performing the IO operations. If so,
then fewer is better than more. So read it in one time. Write it out one
time.

I would be hard pressed to think of other advantages and disadvantages
although I am sure the imagination could run wild.

--
Regards,
Tom Ogilvy

"M. Authement" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am developing an add-in and am using an INI file to store various options
>and lists. My question is this: am I better off reading the INI file into
>a worksheet as part of the Workbook_Open event (and therefore having only 1
>call to the INI file) or just call the INI file as needed? I have a class
>module that defines all of the INI reads/writes, so the code is no problem.
>Just wondering if there are advantages/disadvantages to the two methods.
>TIA.
>
>
> Using WinXP and XL2003.
>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      3rd Dec 2006
I would read the entire INI file at startup, store the values somewhere, and
then write back the entire INI file at shutdown.

As an aside, INI files were supposed to be made obsolete by the System
Registry. Is there any particular reason you are using an INI file rather
than GetSettings and SaveSetting to store data in the registry.

Moreover, why not just save the settings in the add-in itself?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"M. Authement" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am developing an add-in and am using an INI file to store various options
>and lists. My question is this: am I better off reading the INI file into
>a worksheet as part of the Workbook_Open event (and therefore having only 1
>call to the INI file) or just call the INI file as needed? I have a class
>module that defines all of the INI reads/writes, so the code is no problem.
>Just wondering if there are advantages/disadvantages to the two methods.
>TIA.
>
>
> Using WinXP and XL2003.
>



 
Reply With Quote
 
M. Authement
Guest
Posts: n/a
 
      4th Dec 2006
Thanks Bob/Tom/Chip.

Chip,

I was told that there may be some issues with the security settings on some
of our computers (for certain computers just about everything is locked
down). I didn't have a way to test writing to the registry and I don't know
enough to say whether that may be an issue so I went the INI route. I will
eventually get some test time on the different set up and hope to move to
registry rather than INI, but this is the way it is for now. I learned
quite a bit about classes and API calls during the development so certainly
nothing lost in the effort.

I originally had the settings in the add-in workbook, but realized that
users will change some of them (that is the design) and if I ever update the
code, say using registry rather than INI, I want to just replace the .xla
file but needed a way for the users' to keep their settings. Something
about separating the various layers of the application...I read it in
Professional Excel Development :-)

So that's my rationale...suggestions and corrections are always welcome.
Thanks again for the help.

"Chip Pearson" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I would read the entire INI file at startup, store the values somewhere,
>and then write back the entire INI file at shutdown.
>
> As an aside, INI files were supposed to be made obsolete by the System
> Registry. Is there any particular reason you are using an INI file rather
> than GetSettings and SaveSetting to store data in the registry.
>
> Moreover, why not just save the settings in the add-in itself?
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email address is on the web site)
>
>
> "M. Authement" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I am developing an add-in and am using an INI file to store various
>>options and lists. My question is this: am I better off reading the INI
>>file into a worksheet as part of the Workbook_Open event (and therefore
>>having only 1 call to the INI file) or just call the INI file as needed?
>>I have a class module that defines all of the INI reads/writes, so the
>>code is no problem. Just wondering if there are advantages/disadvantages
>>to the two methods. TIA.
>>
>>
>> Using WinXP and XL2003.
>>

>
>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      4th Dec 2006
Permissions may be an issue for writing keys in some registry areas, but if
you use GetSetting(s) and SaveSetting, the keys and values are stored in

HKCU\Software\VB and VBA Program Settings

which you should always have permission to add/change/delete.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"M. Authement" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks Bob/Tom/Chip.
>
> Chip,
>
> I was told that there may be some issues with the security settings on
> some of our computers (for certain computers just about everything is
> locked down). I didn't have a way to test writing to the registry and I
> don't know enough to say whether that may be an issue so I went the INI
> route. I will eventually get some test time on the different set up and
> hope to move to registry rather than INI, but this is the way it is for
> now. I learned quite a bit about classes and API calls during the
> development so certainly nothing lost in the effort.
>
> I originally had the settings in the add-in workbook, but realized that
> users will change some of them (that is the design) and if I ever update
> the code, say using registry rather than INI, I want to just replace the
> .xla file but needed a way for the users' to keep their settings.
> Something about separating the various layers of the application...I read
> it in Professional Excel Development :-)
>
> So that's my rationale...suggestions and corrections are always welcome.
> Thanks again for the help.
>
> "Chip Pearson" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I would read the entire INI file at startup, store the values somewhere,
>>and then write back the entire INI file at shutdown.
>>
>> As an aside, INI files were supposed to be made obsolete by the System
>> Registry. Is there any particular reason you are using an INI file rather
>> than GetSettings and SaveSetting to store data in the registry.
>>
>> Moreover, why not just save the settings in the add-in itself?
>>
>>
>> --
>> Cordially,
>> Chip Pearson
>> Microsoft MVP - Excel
>> Pearson Software Consulting, LLC
>> www.cpearson.com
>> (email address is on the web site)
>>
>>
>> "M. Authement" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>I am developing an add-in and am using an INI file to store various
>>>options and lists. My question is this: am I better off reading the INI
>>>file into a worksheet as part of the Workbook_Open event (and therefore
>>>having only 1 call to the INI file) or just call the INI file as needed?
>>>I have a class module that defines all of the INI reads/writes, so the
>>>code is no problem. Just wondering if there are advantages/disadvantages
>>>to the two methods. TIA.
>>>
>>>
>>> Using WinXP and XL2003.
>>>

>>
>>

>
>



 
Reply With Quote
 
M. Authement
Guest
Posts: n/a
 
      4th Dec 2006
Thanks for clearing that up...time to learn more about the registry and
Get/SaveSetting.

"Chip Pearson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Permissions may be an issue for writing keys in some registry areas, but
> if you use GetSetting(s) and SaveSetting, the keys and values are stored
> in
>
> HKCU\Software\VB and VBA Program Settings
>
> which you should always have permission to add/change/delete.
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email address is on the web site)
>
>
> "M. Authement" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Thanks Bob/Tom/Chip.
>>
>> Chip,
>>
>> I was told that there may be some issues with the security settings on
>> some of our computers (for certain computers just about everything is
>> locked down). I didn't have a way to test writing to the registry and I
>> don't know enough to say whether that may be an issue so I went the INI
>> route. I will eventually get some test time on the different set up and
>> hope to move to registry rather than INI, but this is the way it is for
>> now. I learned quite a bit about classes and API calls during the
>> development so certainly nothing lost in the effort.
>>
>> I originally had the settings in the add-in workbook, but realized that
>> users will change some of them (that is the design) and if I ever update
>> the code, say using registry rather than INI, I want to just replace the
>> .xla file but needed a way for the users' to keep their settings.
>> Something about separating the various layers of the application...I read
>> it in Professional Excel Development :-)
>>
>> So that's my rationale...suggestions and corrections are always welcome.
>> Thanks again for the help.
>>
>> "Chip Pearson" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>I would read the entire INI file at startup, store the values somewhere,
>>>and then write back the entire INI file at shutdown.
>>>
>>> As an aside, INI files were supposed to be made obsolete by the System
>>> Registry. Is there any particular reason you are using an INI file
>>> rather than GetSettings and SaveSetting to store data in the registry.
>>>
>>> Moreover, why not just save the settings in the add-in itself?
>>>
>>>
>>> --
>>> Cordially,
>>> Chip Pearson
>>> Microsoft MVP - Excel
>>> Pearson Software Consulting, LLC
>>> www.cpearson.com
>>> (email address is on the web site)
>>>
>>>
>>> "M. Authement" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>>I am developing an add-in and am using an INI file to store various
>>>>options and lists. My question is this: am I better off reading the INI
>>>>file into a worksheet as part of the Workbook_Open event (and therefore
>>>>having only 1 call to the INI file) or just call the INI file as needed?
>>>>I have a class module that defines all of the INI reads/writes, so the
>>>>code is no problem. Just wondering if there are advantages/disadvantages
>>>>to the two methods. TIA.
>>>>
>>>>
>>>> Using WinXP and XL2003.
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File sort order reversed or wrong in File Open or File Save dialog box NinerSevenTango Windows XP General 1 1st Aug 2009 01:48 PM
coping file from a remote file share - FILE IS NO LONG THERE bogus error message Heith Windows Vista Networking 0 18th Oct 2007 09:58 PM
In file parsing, taking the first few characters of a text file after a readfile or streamreader file read... .Net Sports Microsoft ASP .NET 11 17th Jan 2006 12:44 AM
An Automated process of watching a network file folder, reading a file in it and deleting the file using ASP.NET ? Luis Esteban Valencia Muņoz Microsoft ASP .NET 3 4th Jun 2005 11:56 AM
i received a file that reads powerpoint document file file exten. =?Utf-8?B?Q0NBUk9MQUNFUkVD?= Microsoft Excel Misc 1 4th Dec 2004 05:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 AM.