Expected end of statement

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default Expected end of statement

    Hi all,
    This will be my 1st post on here!
    i am trying to view a list of files within a folder on my server drive using
    this bit of code.

    <%
    dim fs,fo,x
    set fs=Server.CreateObject("Scripting.FileSystemObject ")
    set fo=fs.GetFolder("C:\Documents and Settings\local.myserever\Desktop\Share
    folder\")for each x in fo.files
    'Print the name of all files in the test folder
    Response.write(x.Name & "<br />")
    nextset fo=nothing
    set fs=nothing
    %>Output:

    however all i am getting is
    Microsoft VBScript compilation error '800a0401'
    Expected end of statement
    /asptestpage.asp, line 11
    this is the offending line "set fo=fs.GetFolder("C:\Documents and
    Settings\local.myserever\Desktop\Share folder\")for each x in fo.files"

    i know that comments should have an apostrophe at the end and noticed that
    this code has it at the start however wheni tried to change it it never made
    any difference?
    any ideas
    cheers
    malcolm


    mallyonline Guest

  2. Similar Questions and Discussions

    1. The DREADED Expected end of statement
      Microsoft VBScript compilation error '800a0401' Can someone please look at my code and tell me what the deal is? I am stumped. Expected end of...
    2. Expected end of statement
      Try this instead provider=Microsoft.Jet.oledb.4.0;Data Source=c:\testapp\asp_test.mdb; User ID=('admin'); Password=("")
    3. Expected end of statement
      Can you post the EXACT error you're getting?
    4. 800A0401: Expected End of Statement
      I am trying to get this code going but always the following error message: Error Type: Microsoft VBScript compilation (0x800A0401) Expected end...
    5. Expected end of statement problem
      Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user...
  3. #2

    Default Re: Expected end of statement

    Change it to (changed your naming convention a little too);

    <%
    Dim objFSO,objFldr,objFl, sPath
    sPath = "C:\Documents and Settings\local.myserever\Desktop\Share folder\"
    Set objFSO=Server.CreateObject("Scripting.FileSystemOb ject")
    Set objFldr=objFSO.GetFolder(sPath)
    For Each objFl in objFldr.Files
    'Print the name of all files in the test folder
    Response.Write objFl.Name & "<br />"
    Next
    Set objFldr=Nothing
    Set objFSO=Nothing

    %>

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    [url]www.it-mate.co.uk[/url]

    Keeping it FREE!

    "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message news:d7fke7$6bl$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
    > Hi all,
    > This will be my 1st post on here!
    > i am trying to view a list of files within a folder on my server drive using
    > this bit of code.
    >
    > <%
    > dim fs,fo,x
    > set fs=Server.CreateObject("Scripting.FileSystemObject ")
    > set fo=fs.GetFolder("C:\Documents and Settings\local.myserever\Desktop\Share
    > folder\")for each x in fo.files
    > 'Print the name of all files in the test folder
    > Response.write(x.Name & "<br />")
    > nextset fo=nothing
    > set fs=nothing
    > %>Output:
    >
    > however all i am getting is
    > Microsoft VBScript compilation error '800a0401'
    > Expected end of statement
    > /asptestpage.asp, line 11
    > this is the offending line "set fo=fs.GetFolder("C:\Documents and
    > Settings\local.myserever\Desktop\Share folder\")for each x in fo.files"
    >
    > i know that comments should have an apostrophe at the end and noticed that
    > this code has it at the start however wheni tried to change it it never made
    > any difference?
    > any ideas
    > cheers
    > malcolm
    >
    >
    Steven Burn Guest

  4. #3

    Default Re: Expected end of statement

    Brilliant, fantastic, it worked a treat
    thank you

    have you any idea how to make the link clickable

    "Steven Burn" <somewhere@in-time.invalid> wrote in message
    news:OuzX$XUZFHA.2984@TK2MSFTNGP15.phx.gbl...
    Change it to (changed your naming convention a little too);

    <%
    Dim objFSO,objFldr,objFl, sPath
    sPath = "C:\Documents and Settings\local.myserever\Desktop\Share folder\"
    Set objFSO=Server.CreateObject("Scripting.FileSystemOb ject")
    Set objFldr=objFSO.GetFolder(sPath)
    For Each objFl in objFldr.Files
    'Print the name of all files in the test folder
    Response.Write objFl.Name & "<br />"
    Next
    Set objFldr=Nothing
    Set objFSO=Nothing

    %>

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    [url]www.it-mate.co.uk[/url]

    Keeping it FREE!

    "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message
    news:d7fke7$6bl$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
    > Hi all,
    > This will be my 1st post on here!
    > i am trying to view a list of files within a folder on my server drive
    > using
    > this bit of code.
    >
    > <%
    > dim fs,fo,x
    > set fs=Server.CreateObject("Scripting.FileSystemObject ")
    > set fo=fs.GetFolder("C:\Documents and
    > Settings\local.myserever\Desktop\Share
    > folder\")for each x in fo.files
    > 'Print the name of all files in the test folder
    > Response.write(x.Name & "<br />")
    > nextset fo=nothing
    > set fs=nothing
    > %>Output:
    >
    > however all i am getting is
    > Microsoft VBScript compilation error '800a0401'
    > Expected end of statement
    > /asptestpage.asp, line 11
    > this is the offending line "set fo=fs.GetFolder("C:\Documents and
    > Settings\local.myserever\Desktop\Share folder\")for each x in fo.files"
    >
    > i know that comments should have an apostrophe at the end and noticed that
    > this code has it at the start however wheni tried to change it it never
    > made
    > any difference?
    > any ideas
    > cheers
    > malcolm
    >
    >

    mallyonline Guest

  5. #4

    Default Re: Expected end of statement

    Your welcome ;o)

    As for making it clickable, change;

    Response.Write objFl.Name & "<br />"

    To;

    Response.Write "<a href=""objFl.Name"" target=""_blank"">" & objFl.Name & "</a><br />"

    NB: Using objFl.Name in the href parameter assumes the file is in the same folder as your script. If not, change objFl.Name to objFl.Path

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    [url]www.it-mate.co.uk[/url]

    Keeping it FREE!

    "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message news:d7fo52$8d7$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
    > Brilliant, fantastic, it worked a treat
    > thank you
    >
    > have you any idea how to make the link clickable
    >
    > "Steven Burn" <somewhere@in-time.invalid> wrote in message
    > news:OuzX$XUZFHA.2984@TK2MSFTNGP15.phx.gbl...
    > Change it to (changed your naming convention a little too);
    >
    > <%
    > Dim objFSO,objFldr,objFl, sPath
    > sPath = "C:\Documents and Settings\local.myserever\Desktop\Share folder\"
    > Set objFSO=Server.CreateObject("Scripting.FileSystemOb ject")
    > Set objFldr=objFSO.GetFolder(sPath)
    > For Each objFl in objFldr.Files
    > 'Print the name of all files in the test folder
    > Response.Write objFl.Name & "<br />"
    > Next
    > Set objFldr=Nothing
    > Set objFSO=Nothing
    >
    > %>
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > [url]www.it-mate.co.uk[/url]
    >
    > Keeping it FREE!
    >
    > "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message
    > news:d7fke7$6bl$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
    > > Hi all,
    > > This will be my 1st post on here!
    > > i am trying to view a list of files within a folder on my server drive
    > > using
    > > this bit of code.
    > >
    > > <%
    > > dim fs,fo,x
    > > set fs=Server.CreateObject("Scripting.FileSystemObject ")
    > > set fo=fs.GetFolder("C:\Documents and
    > > Settings\local.myserever\Desktop\Share
    > > folder\")for each x in fo.files
    > > 'Print the name of all files in the test folder
    > > Response.write(x.Name & "<br />")
    > > nextset fo=nothing
    > > set fs=nothing
    > > %>Output:
    > >
    > > however all i am getting is
    > > Microsoft VBScript compilation error '800a0401'
    > > Expected end of statement
    > > /asptestpage.asp, line 11
    > > this is the offending line "set fo=fs.GetFolder("C:\Documents and
    > > Settings\local.myserever\Desktop\Share folder\")for each x in fo.files"
    > >
    > > i know that comments should have an apostrophe at the end and noticed that
    > > this code has it at the start however wheni tried to change it it never
    > > made
    > > any difference?
    > > any ideas
    > > cheers
    > > malcolm
    > >
    > >
    >
    >
    Steven Burn Guest

  6. #5

    Default Re: Expected end of statement

    This is absolute dynamite
    Thank you
    But apart from making it clickable! how can i make it download a file from
    that folder :)
    all that happens when i click is the standard 404 error message.....

    cheers
    malcolm


    "Steven Burn" <somewhere@in-time.invalid> wrote in message
    news:O7QBo7UZFHA.2400@TK2MSFTNGP10.phx.gbl...
    Your welcome ;o)

    As for making it clickable, change;

    Response.Write objFl.Name & "<br />"

    To;

    Response.Write "<a href=""objFl.Name"" target=""_blank"">" & objFl.Name
    & "</a><br />"

    NB: Using objFl.Name in the href parameter assumes the file is in the same
    folder as your script. If not, change objFl.Name to objFl.Path

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    [url]www.it-mate.co.uk[/url]

    Keeping it FREE!

    "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message
    news:d7fo52$8d7$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
    > Brilliant, fantastic, it worked a treat
    > thank you
    >
    > have you any idea how to make the link clickable
    >
    > "Steven Burn" <somewhere@in-time.invalid> wrote in message
    > news:OuzX$XUZFHA.2984@TK2MSFTNGP15.phx.gbl...
    > Change it to (changed your naming convention a little too);
    >
    > <%
    > Dim objFSO,objFldr,objFl, sPath
    > sPath = "C:\Documents and Settings\local.myserever\Desktop\Share folder\"
    > Set objFSO=Server.CreateObject("Scripting.FileSystemOb ject")
    > Set objFldr=objFSO.GetFolder(sPath)
    > For Each objFl in objFldr.Files
    > 'Print the name of all files in the test folder
    > Response.Write objFl.Name & "<br />"
    > Next
    > Set objFldr=Nothing
    > Set objFSO=Nothing
    >
    > %>
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > [url]www.it-mate.co.uk[/url]
    >
    > Keeping it FREE!
    >
    > "mallyonline" <malcolmkwhyte@btinternet.com> wrote in message
    > news:d7fke7$6bl$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
    > > Hi all,
    > > This will be my 1st post on here!
    > > i am trying to view a list of files within a folder on my server drive
    > > using
    > > this bit of code.
    > >
    > > <%
    > > dim fs,fo,x
    > > set fs=Server.CreateObject("Scripting.FileSystemObject ")
    > > set fo=fs.GetFolder("C:\Documents and
    > > Settings\local.myserever\Desktop\Share
    > > folder\")for each x in fo.files
    > > 'Print the name of all files in the test folder
    > > Response.write(x.Name & "<br />")
    > > nextset fo=nothing
    > > set fs=nothing
    > > %>Output:
    > >
    > > however all i am getting is
    > > Microsoft VBScript compilation error '800a0401'
    > > Expected end of statement
    > > /asptestpage.asp, line 11
    > > this is the offending line "set fo=fs.GetFolder("C:\Documents and
    > > Settings\local.myserever\Desktop\Share folder\")for each x in fo.files"
    > >
    > > i know that comments should have an apostrophe at the end and noticed
    > > that
    > > this code has it at the start however wheni tried to change it it never
    > > made
    > > any difference?
    > > any ideas
    > > cheers
    > > malcolm
    > >
    > >
    >
    >

    mallyonline Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139