Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Variable Filename in OpenTextFile
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Variable Filename in OpenTextFile

 Post Reply Post Reply
Author
fark View Drop Down
Newbie
Newbie


Joined: 04 November 2003
Location: United States
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote fark Quote  Post ReplyReply Direct Link To This Post Topic: Variable Filename in OpenTextFile
    Posted: 26 November 2003 at 4:56pm

 I'm trying to open a text file using this statement

Set objTextFile = objFSO.OpenTextFile (File, fsoForReading, False)

but I get this error.

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument

/ups/csvfile2.asp, line 71

When I put a static "C:\Inetpub\wwwroot\ups\TempData.txt" instead of a variable it works.  Am I allowed to use a variable for the file name?  I didn't want to spend a huge amount of time error checking what's in the File variable if I can't even do it in the first place.  Thanks.

Back to Top
FrankHenkel View Drop Down
Newbie
Newbie


Joined: 26 November 2003
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote FrankHenkel Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 5:38pm

Is FSO enabled on your server? 

I had this error once and it was because my host turned off FSO on my server because people were getting into other's sites.  (shared hosting )  They moved me to a server with FSO enabled and it worked fine.

However, I must throw in my disclaimer:  I'm usually wrong!

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 6:17pm

yes, you can use variables to specifiy location.....

something else is wrong with your code

Contribute to the working anarchy we fondly call the Internet
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 6:29pm
Make sure File isnt a reserved word, try renamin the file variable to strFilePath
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 6:32pm

excellent point.....

that's some damn good advice right there

Contribute to the working anarchy we fondly call the Internet
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 6:54pm
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 7:49pm

the variable name 'file' is reserved. do what gullanian suggested

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.