I am trying to use the following ASP code to examine the file names in
a folder:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
Can anyone shed any light on this?
Thanks 7 14259
For what it is worth, I have run this as both a stand alone vbscript and as
an ASP page, and the only thing I changed was the path in the GetFolder
command, and it worked fine for both. Both for a folder that did and didn't
have contents. My only suggestions, are double check that you have the path
correct and check that you have appropriate permissions to the folder.
Also it might be worth running this script as a vbscript ie take the code,
put it in a file called xxxx.vbs, change response.write( s) to msgbox s, save
and run it by double clicking. This may help identify if it is a permissions
problem.
Hope this helps
Janette
<go****@western wares.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>I am trying to use the following ASP code to examine the file names in
a folder:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
Can anyone shed any light on this?
Thanks
your code works for me, may be something to do with the path you have
stated. Try:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(S erver.MapPath("/subfolder"))
Set fs = f.Files
For Each fl in fs
s = fl.Name
Response.Write( s)
Next
Set fso = Nothing
might help fix the problem....but here it seems to work.
You may have other code in that file that is effecting this trouble line, in
which case, something like http://www.aspfaq.com/show.asp?id=2283 might be
somewhere to point you in (it might not have any direct relevance.
I would also recommend you choose better object names, I don't think the
ones you have chosen help debug.
Good luck.
Stu
--
<go****@western wares.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>I am trying to use the following ASP code to examine the file names in
a folder:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
Can anyone shed any light on this?
Thanks
i dont think you can do a server.MapPath with folders beginning with a " / "
try
Set f = fso.GetFolder(S erver.MapPath(" subfolder/"))
that usually works for me.......
hope this helps......
<go****@western wares.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>I am trying to use the following ASP code to examine the file names in
a folder:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
Can anyone shed any light on this?
Thanks
Stuart,
Thanks for this link, although I had already found this page myself
earlier.
I've now solved the problem, and this link turned out to be relevant
after all!
It was solved when I cut and pasted my code into this newsgroup for
further help.
Suddenly the 'fl' variable showed up as 'f1' - a typo!!!
My original code was written in Dreamweaver and the font they use for
code looks EXACTLY the same for the lower case letter L and the digit
One.
So, your comment about object names was also relevant - but note that
this code is taken verbatim from the Microsoft Help file for
FileSystemObjec t (except for the typo)!
Thanks everyone for the help!
Stuart Palmer wrote:
your code works for me, may be something to do with the path you have
stated. Try:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(S erver.MapPath("/subfolder"))
Set fs = f.Files
For Each fl in fs
s = fl.Name
Response.Write( s)
Next
Set fso = Nothing
might help fix the problem....but here it seems to work.
You may have other code in that file that is effecting this trouble line, in
which case, something like http://www.aspfaq.com/show.asp?id=2283 might be
somewhere to point you in (it might not have any direct relevance.
I would also recommend you choose better object names, I don't think the
ones you have chosen help debug.
Good luck.
Stu
--
<go****@western wares.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
I am trying to use the following ASP code to examine the file names in
a folder:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
Can anyone shed any light on this?
Thanks
<%Option Explicit%would have prevented that.
--
Mike Brind
hogwell wrote:
Stuart,
Thanks for this link, although I had already found this page myself
earlier.
I've now solved the problem, and this link turned out to be relevant
after all!
It was solved when I cut and pasted my code into this newsgroup for
further help.
Suddenly the 'fl' variable showed up as 'f1' - a typo!!!
My original code was written in Dreamweaver and the font they use for
code looks EXACTLY the same for the lower case letter L and the digit
One.
So, your comment about object names was also relevant - but note that
this code is taken verbatim from the Microsoft Help file for
FileSystemObjec t (except for the typo)!
Thanks everyone for the help!
Stuart Palmer wrote:
your code works for me, may be something to do with the path you have
stated. Try:
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(S erver.MapPath("/subfolder"))
Set fs = f.Files
For Each fl in fs
s = fl.Name
Response.Write( s)
Next
Set fso = Nothing
might help fix the problem....but here it seems to work.
You may have other code in that file that is effecting this trouble line, in
which case, something like http://www.aspfaq.com/show.asp?id=2283 might be
somewhere to point you in (it might not have any direct relevance.
I would also recommend you choose better object names, I don't think the
ones you have chosen help debug.
Good luck.
Stu
--
<go****@western wares.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>I am trying to use the following ASP code to examine the file names in
a folder:
>
Dim fso, f, fl, s, fs
Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older")
Set fs = f.Files
For Each fl in fs
s = fl.Name 'Object Required error occurs here!
Response.Write( s)
Next
Set fso = Nothing
>
The asp page returns the 'Object Required' error on the line, "s =
fl.Name".
Why?
>
Can anyone shed any light on this?
>
Thanks
>
On 28/07/2006 17:23, hogwell wrote:
Stuart,
Thanks for this link, although I had already found this page myself
earlier.
I've now solved the problem, and this link turned out to be relevant
after all!
It was solved when I cut and pasted my code into this newsgroup for
further help.
Suddenly the 'fl' variable showed up as 'f1' - a typo!!!
My original code was written in Dreamweaver and the font they use for
code looks EXACTLY the same for the lower case letter L and the digit
One.
So, your comment about object names was also relevant - but note that
this code is taken verbatim from the Microsoft Help file for
FileSystemObjec t (except for the typo)!
Thanks everyone for the help!
Stuart Palmer wrote:
>your code works for me, may be something to do with the path you have stated. Try:
Dim fso, f, fl, s, fs Set fso = CreateObject("S cripting.FileSy stemObject") Set f = fso.GetFolder(S erver.MapPath("/subfolder")) Set fs = f.Files For Each fl in fs s = fl.Name Response.Write (s) Next Set fso = Nothing
might help fix the problem....but here it seems to work.
You may have other code in that file that is effecting this trouble line, in which case, something like http://www.aspfaq.com/show.asp?id=2283 might be somewhere to point you in (it might not have any direct relevance.
I would also recommend you choose better object names, I don't think the ones you have chosen help debug.
Good luck. Stu
--
<go****@wester nwares.comwrote in message news:11******* *************** @p79g2000cwp.go oglegroups.com. ..
>>I am trying to use the following ASP code to examine the file names in a folder:
Dim fso, f, fl, s, fs Set fso = CreateObject("S cripting.FileSy stemObject") Set f = fso.GetFolder(" C:\Inetpub\wwwr oot\MySite\subf older") Set fs = f.Files For Each fl in fs s = fl.Name 'Object Required error occurs here! Response.Writ e(s) Next Set fso = Nothing
The asp page returns the 'Object Required' error on the line, "s = fl.Name". Why?
Can anyone shed any light on this?
Thanks
As always, best to use Option Explicit on all scripts.
Lee
Gazing into my crystal ball I observed "Mike Brind" <pa*******@hotm ail.com>
writing in news:11******** **************@ m73g2000cwd.goo glegroups.com:
><%Option Explicit%would have prevented that.
I love Option Explict so much I think I'll marry it ;-)
--
Adrienne Boswell at Home
Arbpen Web Site Design Services http://www.cavalcade-of-coding.info
Please respond to the group so others can share This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Apostolis K. |
last post by:
At first I make a independend virtual directory wich I named app and I check
Directory Browsing in the Virtual Directory Properties. Then I create with
notepad global.asa and index.asp
global.asa
<OBJECT ID="objMyInfo" RUNAT="server" SCOPE="Application"
PROGID="MSWC.MYInfo"></OBJECT>
<SCRIPT Language="VBScript" RUNAT="server">
Sub Application_onStart()
objMyInfo.vDailyBanner="The Big News Today is..."
|
by: News Groups |
last post by:
Dear Group
I am trying to use the following code to refer to a form and control on my
form. I am supposed to be using VBSCRIPT for this code.
I always get an "object required: 'document' " error:
<%
Dim Myform
Set Myform = document.forms.thisform
Myform.textbox1.value = "fish" %>
|
by: contact |
last post by:
Hi, I'm trying to use the following to replace a text string in all the
links on a page:
var arrLinks = document.links;
for(var LinkIterator = 0; LinkIterator < arrLinks.length;
LinkIterator++) {
if(arrLinks.firstChild.nodeValue == "More
Information"){
arrLinks.firstChild.nodeValue = "More";
};
|
by: RICHARD BROMBERG |
last post by:
I am using Access 200.
I have a form which includes text boxes L1, L2 and L3
And a table tblGrades with number fields L1, L2 and L3
|
by: imatts |
last post by:
Hi can anyone help with this little problem. I have a simple script to
swap between two divs on a page. It works perfectly in Firefox & Safari
& Opera. It fails in IE 6 giving Object Required error on initializing
second variable var layer2. I can't get to the bottom of this. Can
anyone help?
<script type="text/javascript">
function showhide(element) {
var layer1 = document.getElementById('layer1').style;
var layer2 =...
| |
by: tcnjdeluca |
last post by:
Hello I am sorry if this is a really novice question, but I am virtually clueless when it comes to Javascript. I have a page that is running the "leightbox" script. I have modified the script as per a suggestion on Quaint Tech so the lightbox will appear on the page load (when required). The script works great in FireFox and Safari. Clicking on a link will pull up the lightbox as it should in IE. However when I click the link that is...
|
by: ash2009 |
last post by:
Hi,
I am getting an object required error on IE6
Line: 1826
Char:3
Code:0
When I do view Source on my browser: here's what I see for line 1826:
function navBarGetMousePosition(e){
|
by: Sneha Bele |
last post by:
Hi, I am beginner in Visual Basic. I am doing a simple ADODC project using MS Acces. In that when I add new record to the database it gives me error 'Object Required'.
I tried the same code onj different form but it is giving me same error. All the connections seem ok as the data is properly fetched at startup and ADODC control works fine navigating through db.
Please help me. My code is as follows...
Private Sub Form_Load()
Set...
|
by: ibrahim Nohbala |
last post by:
Hello.
I've written a small program in MS Access 2007 that calculates how many goods left in stock in 3 different units. For example, I have a product that has 3 units of measurement: gr,kg and Piece (P). There are 1000gr in 1kg and 3.5kg in 1P. I'm collecting amounts in minimal units in this example in grams. I want the program to show me the result in all 3 units as there are 4770gr left in my stock. I have a query "mal_hereketi_tam" that...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |