?
Solved

PowerPoint 2003 macro to auto run .exe file

Posted on 2006-03-20
12
Medium Priority
?
741 Views
Last Modified: 2012-05-05
I have a PowerPoint presentation and on one of the slides I have a button to play an .exe file, I have located in the same folder.  When I click to play the file the usual warning message pops up:
Some files can contain viruses..yada yada yada....Would you like to open this file? um, yes...

is there a way around this? i saw an another post adding this into the macro for the page, but it didn't work:
Dim RetVal
RetVal = shell("C:\myfile.exe",1)

My last resort has been to set my security to "LOW" temporarily when I want to run PowerPoint presentations; which is very frequent.  I'd rather add a macro w/the correct coding to have it run automatically.  Just in case I forget to change the security settings back.
0
Comment
Question by:mdmcq5
  • 7
  • 2
  • 2
  • +1
12 Comments
 
LVL 81

Expert Comment

by:byundt
ID: 16243319
Hi mdmcq5,
I'm not getting the warning message. But if you are, consider surrounding your Shell statement with code to turn alerts off and then back on:

Private Sub CommandButton1_Click()
Dim RetVal
Application.DisplayAlerts = False
RetVal = Shell("C:\Program Files\IrfanView\i_view32.exe", 1)
Application.DisplayAlerts = True
End Sub

Cheers!

Brad
0
 

Author Comment

by:mdmcq5
ID: 16243374
I'm not powerpoint guru & the presentation wasn't created by me & actually dont know how they added the button that leds to the .exe. But, anyway, if I just add this coding into a macro on that particular slide, the message should no longer appear?

& this line I should change to were the .exe file resides?
RetVal = Shell("C:\Program Files\IrfanView\i_view32.exe", 1)

& where can I check on this particular page to be certain they have named this linked button as CommandButton1?
0
 
LVL 81

Expert Comment

by:byundt
ID: 16243438
mdmcq5,
If you right-click on the button (while in slide editing mode), you can choose "Properties" from the resulting pop-up. The name of the button is the "(Name)" property at the top of the Properties dialog.

If you choose "View code" after right-clicking the button, you will see the macro linked to that button.

I'm not a PowerPoint wizard either--but I do know my way around VBA. If you can find the statement that launches the .exe file in the macro, try surrounding it with the two statements in my previous post to turn Alerts off and then back on. I used the RetVal=Shell(... statement in my test presentation just  because that was the code you posted, and IrfanView was a handy .exe file to try running.
Brad
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 

Author Comment

by:mdmcq5
ID: 16243583
I'll take a look tomorrow; file on PC there. And will attempt your coding suggestion. Keep ya posted!
0
 
LVL 44

Accepted Solution

by:
bruintje earned 750 total points
ID: 16243968
Hello mdmcq5,

>> When I click to play the file the usual warning message pops up:
>> Some files can contain viruses..yada yada yada....Would you like to open this file? um, yes...

that warning only pops up when opening the powerpoint file not when running the code behind the button on button click so you do not need any additional code, turning off the security warnings under macro | security was enough

here is a sample ppt file containing that code which is familair ;-)

source: http://www.traktiq.net/ee_temp/ppt_21781745.ppt
----------
1. open your powerpint presentation
2. show the toolbox through view | toolbox
3. drag a button to the slide
4. doubleclick the button
5. the resulting eventhandler looks like

Private Sub CommandButton1_Click()

End Sub

6. add your lines to make it look like

Private Sub CommandButton1_Click()
  Dim RetVal
  RetVal = Shell("C:\myfile.exe", 1)
End Sub

7. change the path to your exe, eg this line

"C:\myfile.exe"

8. close the vb editor
9. run the presentation and click the button
----------

just comment on the results

hope this helps a bit
bruintje
0
 

Author Comment

by:mdmcq5
ID: 16247091
Ok, it's actually a picture containing a picture of a button and the whole page is linked to an "Action Setting" where the .exe is set under Mouse Click -> Run Program -> launch.exe
0
 

Author Comment

by:mdmcq5
ID: 16259190
So, any additional input? was lowering the security the only option since the .exe was attached to a picture?
0
 
LVL 44

Expert Comment

by:bruintje
ID: 16278510
yes it really shouldn't make a difference where the macro was attached to, that warning comes only from opening a file that contains a macro
0
 

Author Comment

by:mdmcq5
ID: 16280043
The file being opened is an .exe file, and that is why the warning message is appearing.  There is no macro.  Is there something other than lowering the security on powerpoint, to stop the warning from appearing when attempting to launch the application attached to the powerpoint slide?  Macro coding?
0
 
LVL 11

Expert Comment

by:asian_niceguy
ID: 16339378
the actual linking of the executable file is a powerpoint macro in itself. so in this case you must lower the security to prevent pop up warning essages occuring.
0
 

Author Comment

by:mdmcq5
ID: 16342768
So, basically as I've said....What I did was the only option....I was referring more to adding coding into a macro to stop the pop-up; that's not an option or resolution?

Let's stop repeating ourselves, please....
0
 

Author Comment

by:mdmcq5
ID: 16342874
according to everyone so far my original solution to my own question was the only option; unless someone else can chime in now..
My last resort has been to set my security to "LOW" temporarily when I want to run PowerPoint presentations; which is very frequent.  I'd rather add a macro w/the correct coding to have it run automatically.  Just in case I forget to change the security settings back.

Although, I answered my own question; I'm rewarding bruintje the points b/c he was more on target.  Even though this particular presentation does not contain any Command buttons for entering the End Sub commands to stop the pop ups.  Closing question this way is much quicker than waiting four days for admins to; especially when making the request counts towards your question count ->
>> When I click to play the file the usual warning message pops up:
>> Some files can contain viruses..yada yada yada....Would you like to open this file? um, yes...

that warning only pops up when opening the powerpoint file not when running the code behind the button on button click so you do not need any additional code, turning off the security warnings under macro | security was enough

here is a sample ppt file containing that code which is familair ;-)

source: http://www.traktiq.net/ee_temp/ppt_21781745.ppt
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question