0

I'm trying to find a way to write data structural to a .xml or .ini-file with VBA working on Word 2011 on Mac.

But I can't find any way to do this.

Word for Mac doesn't seem to have the same reference to XML-library as on Word for PC. And I guess .ini-files is a PC thing, since the System.PrivateProfileString won't work on Word 2011.

Does anyone have any solutions to this? Or maybe some suggestion on other methods to use?

EDIT: It seems to work with the following: System.ProfileString("test", "testing") = "the test" MsgBox(System.ProfileString("test", "testing"))

I'm not sure how this is stored really, but I see that the file com.microsoft.Word.plist gets updated in the Preference folder when using the command. When I open the file in text edit it contains a lot of "jibberish", but if i search for "the test" i find it in clear text in the file. Since System. Private ProfileString doesn't work it doesn't seem that I can choose where to store it.

The best thing to do would be to store it in xml and make it work on both PC and Mac, but I guess there isn't a way to do this in VBA for Mac on Word 2011?

effico
  • 13
  • 4

1 Answers1

-1

INI files are a Windows thing; System.anything is a .NET thing, not VBA.

SaveSetting in Windows VBA writes to a specific area of the registry. On Mac, it writes to a .plist (XML) file specific to the app.

The file's in Users:[username]:Library:Preferences

You wouldn't want to use this for general purpose data storage, but for app settings, it'd be reasonable.

Steve Rindsberg
  • 3,470
  • 1
  • 16
  • 10
  • 1
    Thanks for answering! I did some more testing and it seems like i got System.ProfileString to work. **System.ProfileString("test", "testing") = "the test"** seems to work. I'm not sure where it is stored yet, but it works to retrieve the data with **MsgBox(System.ProfileString("test","testing"))** – effico May 09 '12 at 06:42