nimishbhuta
6 years agoFrequent Contributor
Insert PDF file into excel sheet
Hello All,
Scenario : I need to have the PDF document shown in the excel sheet. One way I can do it by taking screenshot of PDF file but then it will show for the first page shown on the scree...
- 6 years ago
Hi nimishbhuta,
The following code adds a pdf file to an Excel file - it works on my computer:
Sub Test Set Excel = Sys.OleObject("Excel.Application") Excel.Workbooks.Open("<path to your Excel file>") Set Ws = Excel.ActiveSheet 'Add the pdf file Set OLEObj=Ws.OLEObjects.Add(,"<path to your PDF file>",true,false) 'If you want to add the file to a specific place With OLEObj .Left = Ws.Range("A1").Left .Height = Ws.Range("A1").Height .Width = Ws.Range("A1").Width .Top = Ws.Range("A1").Top End With Excel.Quit End Sub
P.S. Sometimes I simply love coding :)