![]() |
Reading from ini file
I need to create a macro in Excel which reads from an ini file. Word
uses the system.privateprofilestring but I can't find anything like this in Excel. Any suggestions greatly appreciated! |
Reading from ini file
Tammy, :)
Because an ini file is just a text file, it can be read with Ope statment. Code ------------------- Sub test() Dim fn As Long Dim tmp As String fn = FreeFile 'Change here to the file path Open "c:\test.ini" For Input As fn Do While Not EOF(fn) Line Input #fn, tmp Debug.Print tmp Loop Close fn End Sub ------------------- -- Message posted from http://www.ExcelForum.com |
Reading from ini file
Tammy,
In Excel you have to use the GetPrivateProfileString, WritePrivateProfileString APIs, so requires much more coding. I have a demo somewhere (using CDPlayer.ini), would you like me to dig it out? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tammy" wrote in message om... I need to create a macro in Excel which reads from an ini file. Word uses the system.privateprofilestring but I can't find anything like this in Excel. Any suggestions greatly appreciated! |
Reading from ini file
That would be great! Thanks Bob.
"Bob Phillips" wrote in message ... Tammy, In Excel you have to use the GetPrivateProfileString, WritePrivateProfileString APIs, so requires much more coding. I have a demo somewhere (using CDPlayer.ini), would you like me to dig it out? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tammy" wrote in message om... I need to create a macro in Excel which reads from an ini file. Word uses the system.privateprofilestring but I can't find anything like this in Excel. Any suggestions greatly appreciated! |
Reading from ini file
Thanks Colo - I'll give that a try as well and see how it goes!
Colo wrote in message ... Tammy, :) Because an ini file is just a text file, it can be read with Open statment. Code: -------------------- Sub test() Dim fn As Long Dim tmp As String fn = FreeFile 'Change here to the file path Open "c:\test.ini" For Input As fn Do While Not EOF(fn) Line Input #fn, tmp Debug.Print tmp Loop Close fn End Sub -------------------- --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 11:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com