Application.Displayalerts not working...

rbon

New Member
Joined
Aug 16, 2012
Messages
5
Hello,

I've got this piece of code, supposed to open external files (which are flash videos):


Public Sub Open_External_File()
Dim sExternal_File, sShape, sPath As String

sShape = Application.Caller 'the Shapes are named video01, video02, video03...
sExternal_File = sShape & ".exe"
sPath = "C:\" & sExternal_File

Application.DisplayAlerts = False
ActiveWorkbook.FollowHyperlink Address:=sPath
Application.DisplayAlerts = True
End Sub


The code kinda works, I mean, when I click in any of the shapes I've got along my sheet, the proper file is opened and the video is shown... BUT, before that happens, excel keeps showing me an alert message, that "Application.DisplayAlerts = False" is supposed to prevent.
Intriguing: while running tests, I've tried to open images (.jpg) instead of exe files.
That works perfectly. No alert is shown...
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi Colo,
Thanks for replying!

Okay.... that article you've mentioned is not sooo complicated, guess I understand.
And by the way, the message that's bothering me is:
"Opening <var>path</var>/<var>filename</var>.
Some files can contain viruses or otherwise be harmful to your computer.
It is important to be certain that this file is from a trustworthy source.
Would you like to open this file?"

Wished there was a way to use vba code only, with no registry editing...
There's no work around this?...
 
Upvote 0
Why don't you use the Shell Command instead of using the FollowHyperlink Method ?
 
Upvote 0
Uhuuu !!!!!!!!!!!!
That Shell command was just what I needed!!!
I wasn't aware of it!!!

sReturnVal = Shell(sPath & sExternal_File, vbMaximizedFocus)

Thank you Jaafar!!!
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top