Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading from a text file Jeff Excel Discussion (Misc queries) 1 November 8th 06 08:47 PM
reading from another file and pasting to current file, "combobox" Darius New Users to Excel 1 September 26th 05 07:13 AM
Help reading in a text file Mike[_60_] Excel Programming 1 January 21st 04 06:29 PM
Reading .csv file into array mousetrap Excel Programming 1 November 26th 03 07:47 AM
Reading from file Asif[_3_] Excel Programming 4 November 16th 03 05:28 AM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"