Import .pdf ...?
Solved/Closed
RickRoll
-
Updated on Mar 28, 2017 at 05:13 PM
RickRoll
RickRoll
- Posts
- 1
- Registration date
- Tuesday March 28, 2017
- Status
- Member
- Last seen
- April 12, 2017
Related:
- Import .pdf ...?
- Import pdf to excel vba ✓ - Forum - PDF
- Save as pdf download - Download
- Pdf manager download - Download
- Import whatsapp stickers to telegram - Guide
- All networking commands pdf - Guide
1 reply
TrowaD
Mar 30, 2017 at 11:35 AM
- Posts
- 2886
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- June 27, 2022
Mar 30, 2017 at 11:35 AM
Hi Rick,
The following code has been adjusted to work with pdf files as well as the dummy-proof part. Remove code line 18 when you don't like a message to show.
Best regards,
Trowa
The following code has been adjusted to work with pdf files as well as the dummy-proof part. Remove code line 18 when you don't like a message to show.
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("D5")) Is Nothing Then Exit Sub Application.DisplayAlerts = False 'this will prevent an alert when filename is not found ActiveSheet.OLEObjects.Delete 'deletes previously inserted .pdf If Target.Value = vbNullString Then Exit Sub On Error GoTo ErrorMessage Range("I7").Select ActiveSheet.OLEObjects.Add(Filename:="C:\Users\Henri\Pictures\" & _ Target & ".pdf", Link:=False, DisplayAsIcon:=False).Select Application.DisplayAlerts = True 'enables alerts again when filename is found ErrorMessage: Application.DisplayAlerts = True 'enables alerts again when filename is not found MsgBox "File not found", vbInformation 'this displays a message to inform the user End Sub
Best regards,
Trowa
Apr 12, 2017 at 03:48 AM
Your code works perfectly!
Happy Days!:)