![]() |
Activating EXCEL window from PowerPoint
I have this snippet of code that I suspect needs to be modified. I'm running
this out of PowerPoint and need to know how to get Excel to activate so that it's not out there waiting for me to make a workbook selection. Can someone assist? Thanks Sub OpenExcelWorkbook(myWB As Excel.Workbook, WorkbookIsOpen As Boolean) Dim XLApp As Excel.Application Set XLApp = Nothing On Error Resume Next Set XLApp = GetObject(, "Excel.Application") On Error GoTo 0 If XLApp Is Nothing Then Set XLApp = CreateObject("Excel.Application") XLApp.visible = True End If ' Suspect I need something here to activate Excel With XLApp.FileDialog(msoFileDialogFilePicker) .AllowMultiSelect = False .Filters.Clear .Filters.Add "Excel Files", "*.xls" .FilterIndex = 1 .Title = "Please Select Workbook to open" If .Show = False Then Exit Sub sFile = .SelectedItems(1) End With Application.Activate ShortName = Right(sFile, Len(sFile) - InStrRev(sFile, "\")) On Error Resume Next Set myWB = Nothing Set myWB = XLApp.Workbooks(ShortName) On Error GoTo 0 If myWB Is Nothing Then Set myWB = XLApp.Workbooks.Open(sFile, False) 'Opening to modify WorkbookIsOpen = False Else WorkbookIsOpen = True End If End Sub |
All times are GMT +1. The time now is 05:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com