{"id":50,"date":"2013-09-10T19:23:41","date_gmt":"2013-09-10T19:23:41","guid":{"rendered":"http:\/\/access-diva.com\/blog\/?p=50"},"modified":"2015-12-21T21:19:53","modified_gmt":"2015-12-22T02:19:53","slug":"followhyperlink-to-file-regardless-of-file-extension","status":"publish","type":"post","link":"https:\/\/access-diva.com\/blog\/?p=50","title":{"rendered":"FollowHyperlink to file regardless of File Extension"},"content":{"rendered":"<p>To open a file regardless of the File Extension you can use&#8230;<\/p>\n<p>The below is run from a Command Button on a Form the has a Control listing all the files in said directory.<\/p>\n<p>Windows XP&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n     Dim strFileName As String\r\n     \r\n     strFileName = Dir(&quot;C:\\Documents and Settings\\Regina Whipp\\My Documents\\YourFolcer\\&quot; &amp; Me.FieldOnYourFormThatHasFileName &amp; &quot;*&quot;)\r\n     Application.FollowHyperlink (&quot;C:\\Documents and Settings\\Regina Whipp\\My Documents\\YourFolder\\&quot; &amp; strFileName\r\n<\/pre>\n<p>Windows 7&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n     Dim strFileName As String\r\n\r\n     strFileName = Dir(&quot;C:\\Users\\YourUserName\\Documents\\YourFolder\\&quot; &amp; Me.FieldOnYourFormThatHasFileName &amp; &quot;*&quot;)\r\n     Application.FollowHyperlink (&quot;C:\\Users\\YourUserName\\Documents\\YourFolder\\&quot; &amp; strFileName\r\n<\/pre>\n<p>P.S. Make sure you change the names of *<strong>YourFolder<\/strong>* and *<strong>YourUserName<\/strong>* to match your machine or your Users machine.\u00a0 You do want to add some code to handle opening a File that has an extension for a program not available to the User.<\/p>\n<p><strong>Side Note:<\/strong> Why did I just put this all on one line&#8230; because <strong>FollowHyperlink<\/strong> cannot translate Wildcards.<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_50\" class=\"pvc_stats all  \" data-element-id=\"50\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>To open a file regardless of the File Extension you can use&#8230;<\/p>\n<p>The below is run from a Command Button on a Form the has a Control listing all the files in said directory.<\/p>\n<p>Windows XP&#8230;<\/p>\n<p> Dim strFileName As String strFileName = Dir(&quot;C:\\Documents and Settings\\Regina Whipp\\My Documents\\YourFolcer\\&quot; &amp; Me.FieldOnYourFormThatHasFileName &amp; &quot;*&quot;) Application.FollowHyperlink (&quot;C:\\Documents and Settings\\Regina [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_50\" class=\"pvc_stats all  \" data-element-id=\"50\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,41],"tags":[23,24],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-method","category-vba","tag-followhyperlink","tag-open-file","odd"],"_links":{"self":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":14,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}