Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-14-2018, 04:47 AM
vicmar vicmar is offline Auto Hyperlink PDF files Windows 7 64bit Auto Hyperlink PDF files Office 2010 64bit
Novice
Auto Hyperlink PDF files
 
Join Date: Aug 2017
Posts: 24
vicmar is on a distinguished road
Default Auto Hyperlink PDF files

Hi everyone,

I found a VBA code to make pdf auto hyperlink but my problem is I want the filename that will display is data in my excel not the filename of the PDF.

Example:
Column A
aaa1
aaa2
aaa3

the hyperlink you should insert in column a.

here is the code:

Sub AddHyperlink()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer

'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("\\server\folder\")
i = 2
'loops through each file in the directory
For Each objFile In objFolder.Files
'select cell
Range(Cells(i + 1, 1), Cells(i + 1, 1)).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
objFile.Path, _
TextToDisplay:=objFile.Name
i = i + 1
Next objFile
End Sub



thank you in advance!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
auto populate fields for multiple files w/in folder jbyrd Word 0 07-21-2014 07:35 AM
Auto Backup/Restore ALL OL files? markg2 Outlook 0 12-16-2012 07:23 AM
Auto Hyperlink PDF files Convert word files to html including hyperlink file types MikS Word 3 06-12-2012 05:39 AM
Animation and Auto Playing of Sound Files in Email MJS Outlook 0 02-10-2010 03:23 PM
auto click hyperlink malemodel_75@yahoo.com Outlook 0 02-05-2010 12:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft