Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2005, 04:44 AM
Authorized User
 
Join Date: Nov 2004
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


 
Old February 19th, 2005, 06:26 AM
Friend of Wrox
 
Join Date: Oct 2003
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
 
Old February 19th, 2005, 01:00 PM
Authorized User
 
Join Date: Nov 2004
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?

 
Old February 19th, 2005, 02:35 PM
Friend of Wrox
 
Join Date: Jun 2003
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.
 
Old February 19th, 2005, 10:03 PM
Authorized User
 
Join Date: Nov 2004
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?

 
Old February 21st, 2005, 11:27 PM
Authorized User
 
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

any help??

 
Old February 22nd, 2005, 03:28 AM
Friend of Wrox
 
Join Date: Jun 2003
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.
 
Old February 22nd, 2005, 08:06 AM
Authorized User
 
Join Date: Nov 2004
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?







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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.