PDA

View Full Version : COPY PDF FILES FROM HYPERLINK LIST



MEIR
05-20-2015, 06:03 AM
Hello,

i have excel with links to pdf,jpeg,doc...
i need vba code to get files to specific folder
example:
this my data:
columb A columb B


links
new name


C:\Users\Desktop\44.pdf
A1


C:\Users\Desktop\13.pdf
B3


C:\Users\Desktop\10.pdf
D1


C:\Users\Desktop\44.jpeg
D2


C:\Users\Desktop\20.jpeg
D3


C:\Users\Desktop\123.doc
D4


C:\Users\Desktop\123.xls
D5



i need button when i press all files ( pdf,doc,jpeg) copied to folder C:\Users\Desktop\new data.
copy files no links.

thanks

SamT
05-20-2015, 08:01 AM
Create you button and point it at this sub

Sub MoveAndRenameFiles()
Dim FSO As Object
Dim LastRow As Long
Dim Rw As Long
Const A As Long = 1
Const B As Long = 2
Const DestFolder As String = "C:\Users\Desktop\new data\"

Set FSO = CreateObject("Scripting.FileSystemObject")

With ActiveSheet
LastRow = .Cells(Rows.Count.A).End(xlUp).Row

On Error GoTo ErrHandler
For Rw = 1 To LastRow
FSO.MoveFile .Cells(Rw, A), DestFolder & .Cells(Rw, B)
Next Rw
End With
Exit Sub

ErrHandler:
MsgBox "Check to see that all new names have a file to move"

End Sub

MEIR
05-20-2015, 09:52 PM
Hi,
Thanks
I need CopyAndRenameFiles not MoveAndRenameFiles.
VBA moving files with no extension
Thanks

MEIR
05-21-2015, 02:36 AM
Hi,


i want to ask you
i need VBA
User enter COLUMN & START ROW/
USER ENTER DESTINATION FOLDER NAME FOR COPY
VBA checks if aexisting folder
If not, open a folder with masage: folder openned
when i press copy button:
files copyed to new folder
At the end of copying are given report a text file with a list what was copied


For example:


C: \ DESKTOP \ EXAMPLE.PDF COPYED AND RENAMED TO NEW.PDF
C: \ DESKTOP \ 1.PDF COPYED AND RENAMED TO ACCC.PDF

If there is a blank line - reported "blank line"


Thank you