+ Reply to Thread
Results 1 to 12 of 12

FSO.MoveFile "Invalid Procedure call or argument" Error

Hybrid View

ZIQUI FSO.MoveFile "Invalid... 10-21-2020, 11:55 AM
Pepe Le Mokko Re: FSO.MoveFile "Invalid... 10-21-2020, 11:59 AM
ZIQUI Re: FSO.MoveFile "Invalid... 10-21-2020, 12:03 PM
Pepe Le Mokko Re: FSO.MoveFile "Invalid... 10-22-2020, 02:13 AM
ZIQUI Re: FSO.MoveFile "Invalid... 10-22-2020, 11:18 AM
romperstomper Re: FSO.MoveFile "Invalid... 10-22-2020, 11:35 AM
ZIQUI Re: FSO.MoveFile "Invalid... 10-22-2020, 01:05 PM
romperstomper Re: FSO.MoveFile "Invalid... 10-23-2020, 05:29 AM
  1. #1
    Registered User
    Join Date
    08-19-2020
    Location
    CALIFORNIA, USA
    MS-Off Ver
    2010
    Posts
    4

    FSO.MoveFile "Invalid Procedure call or argument" Error

    Hello,
    The following code returns an "Invalid Procedure call or argument" Error.
    In the instruction: StilesFSO.CopyFile Source:=ListerFolder, Destination:=ToSalvagniniFolder;
    if I disable this line it actually debug.prints the accurate information.
    Can someone help to figure out the issue with it?


    'Paths
    Public MoveFromPath As String, _
            MoveToPath As String
    'Folders
    Public ListerFolder As Folder, _
            ToSalvagniniFolder As Folder
            
    Sub Mve_JOBFiles()
        Dfn_StilesFSO
        Dfn_JobNumberFolder
        Dfn_JobTypeFolder
        Dfn_ReleaseNumberFolder
        Dfn_Rng_RowLastJob
        Select Case Rng_CellRUN_LastJob.Value
            Case 200 To 299
                MoveFromPath = ("\\Xpmode-002\icc\S4.30")
            Case 400 To 499
                MoveFromPath = ("\\Xpmode-samm\icc\S4.30")
            Case 700 To 899
                MoveFromPath = ("\\Warren\s4.30")
            Case 900 To 999
                MoveFromPath = ("\\Xpmode-001\s4.30")
        End Select
                MoveToPath = ("\\SERVER2K8\salvagnini\Salvagnini Jobs\JOB" & JobNumberFolder & "\" & JobTypeFolder & "\" & ReleaseNumberFolder & "\")
            Set ListerFolder = StilesFSO.GetFolder(MoveFromPath)
            'Set ToSalvagniniFolder = StilesFSO.GetFolder(MoveToPath)
            For Each JobFile In ListerFolder.Files
                If Left(JobFile.Name, 3) = RunNumber.text Then
                    StilesFSO.CopyFile Source:=ListerFolder, Destination:=ToSalvagniniFolder
                    Debug.Print JobFile.Name
                End If
            Next JobFile
     End Sub
    Last edited by ZIQUI; 10-22-2020 at 11:17 AM. Reason: MISSING TAGS

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,638

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  3. #3
    Registered User
    Join Date
    08-19-2020
    Location
    CALIFORNIA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    Thank you for replying, and sorry for the inconvenience. I just put the tags in.

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,638

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    Sorry, you seem to have added them manually ( in the wrong order). Select your code and click the # button as indicated in my post

  5. #5
    Registered User
    Join Date
    08-19-2020
    Location
    CALIFORNIA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    Hi, I just fixed. Hopefully is okay now.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,587

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    @Pepe Le Mokko: the # icon is not currently present on the menu bar.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,021

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    You should just pass the folder paths as strings to the CopyFile method.
    Everyone who confuses correlation and causation ends up dead.

  8. #8
    Registered User
    Join Date
    08-19-2020
    Location
    CALIFORNIA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    I did as you said, but still not getting the same error.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,021

    Re: FSO.MoveFile "Invalid Procedure call or argument" Error

    Quote Originally Posted by ZIQUI View Post
    I did as you said, but still not getting the same error.
    I assume you mean you are still getting the error, in which case I'd check your variables - perhaps one of the paths is blank.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Recorded Macro "Invalid procedure or call argument" Error
    By lilit2222 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2020, 05:04 AM
  2. I am getting this error by below macro "Invalid procedure call arguement" please help
    By shoaibaligwl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2017, 09:39 AM
  3. help with "invalid procedure call or argument" error.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2017, 11:41 AM
  4. [SOLVED] run time error '5" invalid procedure call or argument
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2015, 12:29 PM
  5. Run-time Error 5 "Invalid Procedure Call or Argument"
    By dinakar.yadav in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 09:22 AM
  6. WritetoSheet causing "invalid procedure call or argument"
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2013, 03:46 PM
  7. "Invalid procedure call or argument" error when creating Pivot table
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2009, 06:02 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1