+ Reply to Thread
Results 1 to 7 of 7

CopyFile Error 70 [Excel 2010, VBA Only]

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    CopyFile Error 70 [Excel 2010, VBA Only]

    I am attempting to create an install file.

    There are some users using Outlook 2003 and others using Outlook 2010. The macro ensures the msoutl.olb is installed for both versions. But I can't get the CopyFile Command to work without erroring out.

    All paths are correct and I have admin rights to all files/folders...

    Option Explicit
    
    Function fCopy(sFile, dFile)
    
        Dim xlObj As Object
        
        Set xlObj = CreateObject("Scripting.FileSystemObject")
            xlObj.CopyFile sFile, dFile, True
        Set xlObj = Nothing
    
    End Function
    
    Sub Control_Install()
    
        Dim SrceFile As String, SrceFile1 As String
        Dim DestFile As String, DestFile1 As String
    
        If Len(Dir("c:\program files\microsoft office\office11", vbDirectory)) = 0 Then
            MkDir "c:\program files\microsoft office\office11"
        Else
        End If
    
        If Len(Dir("c:\program files\microsoft office\office14", vbDirectory)) = 0 Then
            MkDir "c:\program files\microsoft office\office14"
        Else
        End If
    
        SrceFile = "p:\work comp\tog analysis controls\office11\msoutl.olb"
        SrceFile1 = "p:\work comp\tog analysis controls\office14\msoutl.olb"
        DestFile = "c:\program files\microsoft office\office11\msoutl.olb"
        DestFile1 = "c:\program files\microsoft office\office14\msoutl.olb"
        
        Call fCopy(SrceFile, DestFile)
        Call fCopy(SrceFile1, DestFile1)
    
      
    End Sub

  2. #2
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    Thread bump

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    Why not just use the FileCopy statement?

        FileCopy SrceFile, DestFile
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    Removed the

    overwrite:=True

    still getting Error 70

  5. #5
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    I was getting the same error (70). I read that someone solved it using the FSO, create object, etc...
    It didn't work for me.

    I altered the function as follows but I am getting Error 448 Named Argument Not Found

    Function fCopy(sFile As String, dFile As String, ovrWrite As Boolean) As String
    
        Dim xlObj As Object
        
        Set xlObj = CreateObject("Scripting.FileSystemObject")
            xlObj.CopyFile Source:=sFile, Destination:=dFile, overwrite:=True
        Set xlObj = Nothing
    
    End Function

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    That's a permission error. Try dragging the file from the source to the destination.

  7. #7
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: CopyFile Error 70 [Excel 2010, VBA Only]

    I did that. It turns out that I was still using the file (outlook library in an Addin). I disabled the Addin and it worked perfectly. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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