' Check if where you click is strictly in the range where your file-links are in ' Note: "A2:A4" will also work (from your example) ' Define the range of clickable cells you require. StrGCPath = "C:\Program Files\Google\Chrome\Application\chrome.exe" ' Could it be in your AppData\Local folder ? ' Important! Where is Google Chrome installed at. Private Sub Worksheet_SelectionChange(ByVal Target As Range) In your VBA editor, open the code sheet for the worksheet your file-links are on. VBA.Shell strGCPath & " -profile-directory=Person1 " & " -url " & strUrlFileĪlso, consider if you have a list of files, like in your example, loop through cells or range object, and be aware of how many instances of Google Chrome you may open.Įdit: Open File-Link in an Excel Worksheet by clicking on it you have inserted or formatted the cells as a hyperlink, or left the format as text, you may need to trap the click event within a specified range, so you can open the file-link using a specified browser, in your case Google Chrome. 'Note: the profile name, you can make this a variable too. StrUrlFile = "file:///path/to/file/on/device/the_file.html" 'strUrlFile: path of file on the device you want to opn in chrom 'strGCPath: could be in Program Files, or AppData\Local for the device user Sub OpenBrowserFiles()ĭim strGCPath As String, strUrlFile As String You will need to tweak this for your specific purposes. Assuming Google Chrome is indeed installed on the devices you will run this from, try the following. To open Google Chrome from Excel VBA, use the VBA.Shell command / method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |