INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

continue error

continue error

(OP)
All,
I am getting an error that I cannot figure out. I have a bit of code that loops through a folder and if it finds a file without a particular extension it goes onto the next file. Otherwise it does some processing of the file.

There are two such folders upon which this functionality is exercised. I am including the top part of each. The first succeeds without issue, but the second fails. I have added the failure message after the code. Both are laid out exactly the same way.

The good code:
.
.
.
filex = "txt"
ifcfolder = "D:\IFC\" & trim(Plant) & "\Outbound\Archive"

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(ifcfolder) Then
Set iFolder = FSO.GetFolder(ifcfolder)
Else
Msgbox("Folder " & ifcfolder & " does not exist")
WScript.Quit
End If
Set fs = CreateObject("Scripting.FileSystemObject")

Set a = fs.CreateTextFile("D:\IFC\" & trim(Plant) & "-Deliv.txt", True)

For Each f1 In fso.GetFolder(ifcfolder).Files
If InStr(f1.name, filex) = 0 Then
Continue
End If[
.
.
.

Bad code:
.
.
.
filex = "xml"
ifcfolder = "D:\IFC\" & trim(Plant) & "\Inbound\Archive"

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(ifcfolder) Then
Set iFolder = FSO.GetFolder(ifcfolder)
Else
Msgbox("Folder " & ifcfolder & " does not exist")
WScript.Quit
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("D:\IFC\" & trim(Plant) & "Inv.txt", True)

For Each f2 In fso.GetFolder(ifcfolder).Files

If InStr(f2.name, filex) = 0 Then
Continue
End If
.
.
.

Error from bad code:
---------------------------
Windows Script Host
---------------------------
Script: D:\IFC\Load-Xref.vbs
Line: 79
Char: 4
Error: Type mismatch: 'Continue'
Code: 800A000D
Source: Microsoft VBScript runtime error

---------------------------
OK
---------------------------


Your help is greatly appreciated!

Regards,
David a.k.a. SquirrelMan

RE: continue error

(OP)
Thanks guitarzan.
I guess I am going to need to get on board with Windows Powershell. I am still on Windows 7. Is Windows Powershell available for Windows 7? I have a Windows 2012 server, so I am good there, but I have a company laptop and the corporate image for 10 has not been released, yet.

Regards,
SquirrelMan

RE: continue error

Yes, Windows 7 has Powershell. But not quite sure why you need to move on to that just because VBScript does not have the Continue statement ...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close