Powerpoint VBA: Open Excel On click

Mike Blackman

Well-known Member
Joined
Jun 8, 2007
Messages
2,494
Hi All,

I have a couple of questions about using VBA within Powerpoint;

  1. I want to call an already opened Excel Spreadsheet by clicking on an image
  2. I want to open another Excel Spreadsheet via clicking on an image: I obviously know how to do this from within the VBE in excel but don't know how I get to give excel orders from within Powerpoint

I know how to assign macro's by clicking on images within Powerpoint BTW.

Any help/advice is appreciated.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
OK,

So i'm getting there, I just need to be able to close the userform named CustomerName but it just isn't having it.

Code:
Sub OpenSLAReport()

With Excel.Application
    .Visible = True
    .Workbooks.Open FileName:="C:\Documents and Settings\michael.blackman\My Documents\SLA Template" _
        & "\Models\v5.2\MPLS SLA Report Template v5.2.xls"
    CustomerName.Hide
End With

End Sub

Please help.
 
Last edited:
Upvote 0
Mikey

Is it just

Code:
Unload CustomerName

I take it it is a userform in Powerpoint rather than the opened session of Excel?
 
Upvote 0
Hi Richard,

No its actually a UserForm from the opened Excel model; I tried;

Code:
Unload CustomerName

and

Code:
Unload .CustomerName

and I just can't get it to speak to Excel, i also tried;

Code:
.ActiveWorkbook.CustomerName.Hide = True

Nothing I can think of will shift it.
 
Upvote 0
Do you actually need this userform in Excel? If not you could presumably tell the xlApp not to activate any event code macros.
 
Upvote 0
Hi Rich,

The userform is triggered on Workbook open as I'm sure you've assumed, I will however need all my events in place as I will be demonstrating how my workbook functions and how to use it. I guess the question is, Can I dsable events within my PP code which will stop the On_Open event triggering but enable at the end of the code after the workbook has opened? Does that make sense?

I assume the code would be;

Code:
Sub OpenSLAReport()

With Excel.Application
    .Visible = True
    .EnableEvents = False
    .Workbooks.Open FileName:="C:\Documents and Settings\michael.blackman\My Documents\SLA Template" _
        & "\Models\v5.2\MPLS SLA Report Template v5.2.xls"
    .EnableEvents = True
End With

End Sub
 
Upvote 0
Fair Enough, wasn't sure if the syntax was theoretically correct, assumed it was;

Code:
Excel.Application.EnableEvents = FALSE

It works at least.

Cheers Rich.
 
Upvote 0

Forum statistics

Threads
1,214,121
Messages
6,117,846
Members
448,782
Latest member
lepaulek

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