I'm currently working on an Excel program with VBA and I need to open a file. I have the code below, which all works fine except when a user opens a file a warning message appears stating that some files could contain viruses etc. This is fine, however if a user presses cancel so they decline the opening then VBA spits the dummy. Is there a way to avoid this? Thanks.
Public Sub openFile ()
Dim file As String
file = "c:\somefile"
ActiveWorkbook.FollowHyperlink Address:=file, NewWindow:=True
End Sub