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
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top