Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42454

VBA Excel, Code to open file (Hyperlink to Shell Command)

$
0
0
Hello All,

Please review the full working code to open any file and shows the file path.

Can you please change the code so it can use the Shell command to open the file not hyperlink,
Reason is that I don't want the alert(some files contain viruses........etc) that is asscociated with Hyperlink method to show.
Thank you



Code:

Sub OPENFILE()

    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    Dim vrtSelectedItem As Variant


    With fd
        If .Show = -1 Then
            For Each vrtSelectedItem In .SelectedItems
                ThisWorkbook.FollowHyperlink (vrtSelectedItem)
                Application.CutCopyMode = False

                MsgBox vrtselecteditem
            Next vrtSelectedItem
        'The user pressed Cancel.
        Else
        End If
    End With
    'Set the object variable to Nothing.
    Set fd = Nothing
End Sub


Viewing all articles
Browse latest Browse all 42454

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>