Share via

i need solution

judo skill 1 Reputation point
2021-01-10T19:32:43.543+00:00

hi I use VBA and many time there is an erreor (75) showing about path\file
I canot solve it so ineed the solution .
the code I write is :

Dim i As String
i = TextBox1.Text
FileCopy fpath, "C:\Picture\" & i & ".jpg"

when I run the sub its show to me an error (75).

thanks

Developer technologies | Visual Basic for Applications
0 comments No comments

2 answers

Sort by: Most helpful
  1. Bill Bell 6 Reputation points
    2021-01-14T14:09:52.33+00:00

    I use Microsoft Scripting Runtime when working with files

    Option Explicit
    
    Sub CopyFile()
      Dim iPath As String
      Dim oPath As String
      Dim fso As New FileSystemObject 'Add reference to Microsoft Scripting Runtime'
    
      If fso.FileExists(iPath) Then
        If Not fso.FileExists(oPath) Then
          fso.CopyFile iPath, oPath
        Else
          Call MsgBox("File Exists: " & oPath, vbOKOnly, "File Exists")
        End If
      Else
        Call MsgBox("File Missing: " & iPath, vbOKOnly, "File Missing")
      End If
    End Sub
    

    Was this answer helpful?

    0 comments No comments

  2. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2021-01-11T01:40:16.383+00:00

    @Oscar Maqueda : why is your code better? It uses the same FileCopy function.
    @judo skill : you may want to edit your post and enter a better subject. We all want solutions.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.