Good call! Thank you very much!
I've got it working ALMOST exactly how I want it now. There's one more thing I'd like it to do, but I'm not sure it's possible. First, here's the current code now:
Sub test()
Dim myChart As Chart
Dim myChartData As ChartData
Dim gWorkBook As Excel.Workbook
Dim gWorkSheet As Excel.Worksheet
Set myChart = ActivePresentation.Slides(2).Shapes("Chart7").Chart
Set myChartData = myChart.ChartData
myChartData.Activate
Set gWorkBook = myChart.ChartData.Workbook
Set gWorkSheet = gWorkBook.Worksheets(1)
gWorkSheet.Range("I36").Value = 0.01
gWorkSheet.Range("I37").Value = -0.2
gWorkSheet.Range("I36").Value = -0.2
gWorkSheet.Range("I36").Value = 0
gWorkSheet.Range("I36").Value = -0.05
gWorkBook.Save
gWorkBook.Close
Set gWorkSheet = Nothing
Set gWorkBook = Nothing
Set gChartData = Nothing
Set myChart = Nothing
ActivePresentation.Application.Activate
ActivePresentation.SlideShowSettings.Run
End Sub
So, now if I'm in the presentation and click the button the macro is assigned to, it'll open Excel, change some data, save it, close Excel, and resume the presentation. However, it does all of this in the foreground. Is there a way to make it so that the PowerPoint presentation is always the screen that people see when all of this is running? Basically, I don't want the audience to see that all of this opening, editing, and closing is going on behind the scenes.
Edit: I did find this thread which is similar: http://www.excelforum.com/excel-prog...oreground.html
and tried using this code above the sub
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
and this code within the sub
PowerPoint.Application.Visible = True
SetParent PowerPoint.Application.Hwnd, Application.Hwnd
but the macro does nothing at all when I run it.
I've also tried variations of
ActivePresentation.Windows(1).Visible = True
which include using PowerPoint and Excel instead of ActivePresentation and making them true or false.
Bookmarks