Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
how to write macro code for copying the images(.bmp) from one folder(source folder) and paste into another folder(destination folder).
Any idea on this ?
Thanks in advance.
Try something like this:
Const OverWrite = False
Dim fso, srcFiles, destPath
Set fso = CreateObject("Scripting.FileSystemObject")
srcFiles = “c:\Test\Alarm\*.*”
destPath = “c:\Test\AlarmHistory”
If fso.FolderExists (destPath) = False Then
fso.CreateFolder (destPath)
End If
fso.CopyFile srcFiles, destPath
Hi,
That is working fine.
Can we provide for user chooice to select his destination i.e; not providing destination location to directly.
That mean a computer window should popup and user will choose his/her loaction in the local system.
Can we provide this type of code in macro ?
Thanks in advance.
Hi,
Check with attached text file.
BrowseFolder("",True);
Celambarasan
sub pickfolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Example", 1, "c:\Programs")
If objFolder Is Nothing Then
Wscript.Quit
End If
msgbox "folder: " & objFolder.title & " Path: " & objFolder.self.path
end sub
Hi
i tried below lines its working but in this code itself i am trying to provide the user selectable destination.
what i needs to change in below code to acheive it ?
Sub CopyPasteImages
Dim sOriginFolder, sDestinationFolder, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set vLensInspectionImageNames=ActiveDocument.Variables("vLensInspectionImageNames")
Set vImageSourcePath=ActiveDocument.Variables("vImagesLocation")
Set vImageDestinationPath=ActiveDocument.Variables("vImagesDestination")
ArrFields = split(vLensInspectionImageNames.GetContent.String, ",")
For Each fIndex in ArrFields
sOriginFolder = vImageSourcePath.GetContent.string&fIndex
sDestinationFolder = vImageDestinationPath.GetContent.string&fIndex
if oFSO.fileExists(sOriginFolder) then
oFSO.CopyFile sOriginFolder, sDestinationFolder
end if
Next
End Sub
please can you share your ideas on this.