Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Procedure Call

Status
Not open for further replies.

Councilk

MIS
May 14, 2003
72
US
Hello I have a problem here with an invalid procedure call

'Option Explicit
'On Error Resume next

Dim objNetwork
Dim objFso
Dim objFolder
Dim FromShare

Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
FromShare = "\\Enterprise\Depot1"
DepToShare = "\\Enterprise\Depot"

If objFso.FolderExists(FromShare) Then
Wscript.Echo("Yup, here it is!")
Else
End IF

If objFso.FolderExists("\\Enterprise\Depot") Then
'DepToShare = "\\Enterprise\Depot2"
Wscript.Echo(DepToShare)
Call DepotCopShare
Else
Wscript.Echo("This share is not valid")
End if

Set ObjFso = Nothing

Sub DepotCopShare
set objFso = CreateObject("Scripting.FileSystemObject")
Wscript.echo("Here it Is!")

This portion of the code is where I get the "Invalid Procedure call or argument"
objFso.CopyFolder FromShare, DePToShare , overwrite


End Sub
 
What about replacing this:
objFso.CopyFolder FromShare, DePToShare , overwrite
with this ?
objFso.CopyFolder FromShare, DepToShare, True
or this ?
objFso.CopyFolder FromShare, DepToShare & "\", True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry

None of these code variations worked and it's driving me nuts because I've used this before
 
Do you get the Yup, here it is message ?
Be aware that if FromShare doesn't exist then your script continues to run ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Looking at your code, it seems ok.

I have it working just fine with this:
Code:
'Option Explicit
'On Error Resume next

Dim objNetwork
Dim objFso
Dim objFolder
Dim FromShare

Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
FromShare = "s:\Temp1"
DepToShare = "s:\Temp2"

If objFso.FolderExists(FromShare) Then
	Wscript.Echo("Yup, here it is!")
End IF

If objFso.FolderExists(DepToShare) Then
	'DepToShare = "\\Enterprise\Depot2"
	Wscript.Echo(DepToShare)
	Call DepotCopShare
Else
	Wscript.Echo("This share is not valid")
End if

Set ObjFso = Nothing

Sub DepotCopShare
	set objFso = CreateObject("Scripting.FileSystemObject")
	Wscript.echo("Here it Is!")
	
	'This portion of the code is where I get the "Invalid Procedure call or argument"
	objFso.CopyFolder FromShare, DepToShare , True

End Sub

Obviously I don't have the networked locations you do, so I've used local drives instead.

Perhaps the problem is the user you are running as doesn't have rights to edit the destination directory?

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Hello DPlank,

I actaully checked the permissions and went out to the share to create the folders manually.

This worked fine, and I beleive it's having problems with thw UNC format I'm passing eg "\\Enterprise\Depot"

I would like to lock down why this is being seen as an invalid procedure, or wrong arguments

Thanks for your observation and I'll keep plugging away for now :)
 
Does the Enterprise server really have shared folders with public name Depot and Depot1 ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello PHV,

Yes, this is Windows 2000 server install running in a VMware
session.

I created these as shares and tried to use variables for the UNC names to each share.

I also went as far as to call the "wscript.network" object in order to map the shares and this is working however, I still the dreaded "Invalid procedure call, or Argument"

This is tough when you're at the bottom of the script
 
Hello all,

I decided to go through the shell to perform the copy operations because everything works except the method I was trying to use to copy shares.

I may need to access the shares through a WMI provider and then use variables from that point.

But I've tested the code I have and this works just fine.

I beleive the Fso does is unable to resolve a share name with the UNC convention
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top