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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

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