godsowndevil
05-27-2008, 08:14 AM
Hi,
I have an excel sheet where 1 column has certain text. I have PDF files in a folder & they are saved as per the text in the column.
For Example, if the column E1 has text "ABC_1234", there is a pdf saved by the same name and so on.
I need a code that will look at the text in the column, go to a given folder & attach the corresponding PDF's in another column.
I have a code that activates attaching objects, but I am not sure on how to get it to certain folders/files.
My code is as below:
Sub Attach_Objects
Range("A1").Select
Selection.End(xlToRight).Select
Selection.Copy
Application.CutCopyMode = False
ActiveSheet.OLEObjects.Add(ClassType:="AcroExch.Document", Link:=False, _
DisplayAsIcon:=True, IconFileName:= _
"C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe", IconIndex:=1, _
IconLabel:="").Activate
Selection.ShapeRange.PictureFormat.CropRight = 17.25
Selection.ShapeRange.PictureFormat.CropBottom = 22.51
Selection.ShapeRange.PictureFormat.CropLeft = 19.5
Selection.ShapeRange.PictureFormat.CropBottom = 21.76
End Sub
I have an excel sheet where 1 column has certain text. I have PDF files in a folder & they are saved as per the text in the column.
For Example, if the column E1 has text "ABC_1234", there is a pdf saved by the same name and so on.
I need a code that will look at the text in the column, go to a given folder & attach the corresponding PDF's in another column.
I have a code that activates attaching objects, but I am not sure on how to get it to certain folders/files.
My code is as below:
Sub Attach_Objects
Range("A1").Select
Selection.End(xlToRight).Select
Selection.Copy
Application.CutCopyMode = False
ActiveSheet.OLEObjects.Add(ClassType:="AcroExch.Document", Link:=False, _
DisplayAsIcon:=True, IconFileName:= _
"C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe", IconIndex:=1, _
IconLabel:="").Activate
Selection.ShapeRange.PictureFormat.CropRight = 17.25
Selection.ShapeRange.PictureFormat.CropBottom = 22.51
Selection.ShapeRange.PictureFormat.CropLeft = 19.5
Selection.ShapeRange.PictureFormat.CropBottom = 21.76
End Sub