Páginas

martes, 5 de agosto de 2014

VBA Excel: Como Insertar objetos en hoja de calculo.


Sub InsertObject()
Dim cell As Range
Dim fname As String
Dim filepath As String
Dim file As OLEObjects

For Each cell In Range("a2: a47")
    cell.Offset(0, 2).Select
    fname = cell.Text
    filepath = "C:\Users\Ruben Torres\Desktop\Adam\" & fname & ".xlsx"
       
     ActiveSheet.OLEObjects.Add(filename:=filepath, Link:=False, _
       DisplayAsIcon:=True, IconFileName:= _
       "C:\Windows\Installer\{AC76BA86-7AD7-1033-7B44-AA1000000001}\PDFFile_8.ico", IconIndex:=0, _
       IconLabel:=fname).Select
   
Next cell

End Sub

No hay comentarios:

Publicar un comentario