Adding object name to a cell.

xaser

New Member
Joined
Sep 9, 2015
Messages
11
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.

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
 

Forum statistics

Threads
1,082,441
Messages
5,365,542
Members
400,837
Latest member
ELMST616

Some videos you may like

This Week's Hot Topics

Top