Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    XML / INI (VBA Office 2003)

    I see that many software publishes are using XML format files instead of INI format files to store settings and other config info. I use VBA for Office development, and I'm perfectly content with INI files; System.PrivateProfileString makes writing/reading easy . I've heard several complaints that INI files are outdated... that "they are 16 bit." (I don't think it's the *file* that's 16 or 32 bit, it's the code that reads/writes, no?)

    Is there a feautrue or add-in for VBA that would provide similar funcionality to System.PrivateProfileString for an XML file? Is there any advantage to storing simple settings in an XML file? (There's no cross-platform, multiple application situation involved.)

    Thanks,
    Richard Barrett

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: XML / INI (VBA Office 2003)

    The main advantage of XML files is that it is a universal, self-describing format. This makes it very suitable for data exchange between different applications.
    The downside is that the overhead of reading or writing an XML file is large, although you wouldn't notice that if you used it to store program settings.

    There is no objection at all to using an .ini file to store the settings for your application. Ini files are small, the overhead of reading and writing them is small, and if necessary it's easy to edit them using Notepad or any other text editor. As an alternative, you could store your settings in the Windows Registry; System.PrivateProfileString supports that too.

    An XML file doesn't offer a significant advantage here, since - as you note - you don't want to exchange the settings with other applications.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XML / INI (VBA Office 2003)

    I'd prefer to use GetSetting and SaveSetting to read/write from and to the registry.

    For the rest I agree with Hans completely.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •