Hi Folks,
Is there any way of getting an object name to appear in a cell? I am creating a spreadsheet that allows people to open a PDF object and fill out a checklist. The problem is getting the PDF's name to appear in a cell. Once the object is placed the name becomes "acrobat document". I would like to get the actual file name to appear on the spreadsheet if possible. It does't matter where.
Is there any way of getting an object name to appear in a cell? I am creating a spreadsheet that allows people to open a PDF object and fill out a checklist. The problem is getting the PDF's name to appear in a cell. Once the object is placed the name becomes "acrobat document". I would like to get the actual file name to appear on the spreadsheet if possible. It does't matter where.
Code:
Public Sub btnAddFile()
Dim vFile As Variant
vFile = Application.GetOpenFilename("All Files,*.pdf", Title:=" Find file to insert")
If LCase(vFile) = "false" Then Exit Sub
ActiveSheet.OLEObjects.Add Filename:=vFile, Link:=False, DisplayAsIcon:=False
Range("E2").Select
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
.LockAspectRatio = msoFalse
.Left = ActiveCell.Left
.Top = ActiveCell.Top
.Height = Range("E2:E44").Height
.Width = Range("E2:T2").Width
End With
End Sub