Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 19th, 2005, 03:44 AM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default check for file existance

hi,
how can i check for file existance in a virtual path ?
eg. http://www.yourserver.com/someDirectory/file.doc

thanks


Reply With Quote
  #2 (permalink)  
Old February 19th, 2005, 05:26 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Do you want to check the existence of files in the virtual path of your own application ? If yes,you can use the following code.

Dim objFileSystem
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
if(objFileSyste.FileExists(Server.MapPath(<relativ e path of file>))) then
    Response.Write "File exists"
else
    Response.Write "File does not exist"
end if

<relative path of file> is the path of the file (to be checked) in relation to virtual directory.

If you want to check the existence of file at a different server, you need to use adodb stream object. Please see the following post.

http://p2p.wrox.com/topic.asp?TOPIC_ID=17824
Reply With Quote
  #3 (permalink)  
Old February 19th, 2005, 12:00 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i replaced <relative path of file> with "http://www.yourserver.com/someDirectory/file.doc"
and after running the script it says "object required: 'server'. Code: 800A01A8.

any idea?

Reply With Quote
  #4 (permalink)  
Old February 19th, 2005, 01:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looks to me as if you're using VB6!?

madhukp's code should work in .NET if you use '/someDirectory/file.doc' provided it's on your own machine/server.
Reply With Quote
  #5 (permalink)  
Old February 19th, 2005, 09:03 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am new to VB, but how can i run this code in office macro?

Reply With Quote
  #6 (permalink)  
Old February 21st, 2005, 10:27 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

any help??

Reply With Quote
  #7 (permalink)  
Old February 22nd, 2005, 02:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry! But try to describe which applications you are using, what you have achieved until now and if you're talking Office, post your question in a Wrox vba forum.
Reply With Quote
  #8 (permalink)  
Old February 22nd, 2005, 07:06 AM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am using MS word. i want to have a macro that can check for file existance in a virtual path.
eg. http://www.yourserver.com/someDirectory/file.doc

any help?


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check a file status? tinywizard Visual Basic 2005 Basics 1 August 6th, 2008 09:07 AM
check if file is an image file silver_cuts Classic ASP Basics 10 June 30th, 2004 12:33 AM
Check for existance of a table Lizu SQL Language 3 June 14th, 2004 04:06 PM
Check Existance of file at Client Side hrishimusale Classic ASP Basics 2 September 9th, 2003 03:50 AM



All times are GMT -4. The time now is 04:16 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.