Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Variable used in OpenTextFile() doesnt work??

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1375
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Variable used in OpenTextFile() doesnt work??
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Variable used in OpenTextFile() doesnt work?? - 9/19/2004 8:57:03 PM   
  RossMcCaughrain

 

Posts: 2
Score: 0
Joined: 9/19/2004
From:
Status: offline
Hi all,

Im trying to open files depending on the contents of an ini file selected by the user. I store the input in an array and call the function "oFSO.OpenTextFile()". When I pass to it the line contents of the ini file it errors with cannot find file but when i enter the location manually within the code it works fine! A sample of what im trying to achieve is below:


      

Ive echoed both the paths above and they are identical. Ive run CStr() on aIniPath(0) and still no difference.

If anyone could shed any light on this it would be very much appreciated!

Cheers
Ross
 
 
Post #: 1
 
 Re: Variable used in OpenTextFile() doesnt work?? - 9/19/2004 11:57:52 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Try putting quotes around sIniPath, ex
Set oFile = oFSO.OpenTextFile("""" & sIniPath & """", FORREADING), if this doesn't work, post your code for getting the inipath so it can be tested. I was able to do a quick test with what you posted and it worked for me, but I am not reading from and ini file so that is probably the difference.

Mike

(in reply to RossMcCaughrain)
 
 
Post #: 2
 
 Re: Variable used in OpenTextFile() doesnt work?? - 9/20/2004 3:24:22 AM   
  RossMcCaughrain

 

Posts: 2
Score: 0
Joined: 9/19/2004
From:
Status: offline
Hi,

Ive got it working now. Not sure what fixed it but all of a sudden its started working! Weird. Anyway thanks for your help mike. Much appreciated.

Cheers
Ross

(in reply to RossMcCaughrain)
 
 
Post #: 3
 
 Re: Variable used in OpenTextFile() doesnt work?? - 9/20/2004 8:00:35 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
You weren't holding your mouth right. Glad you got it working.

(in reply to RossMcCaughrain)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Variable used in OpenTextFile() doesnt work?? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts