In excel, you can have a user dynamically select a range of cells by selecting it with his/her mouse or keyboard (e.g., picture below, or simply when you’re typing up a formula on ENTER mode and proceed to select a range of cells):
Does anyone know if such a functionality is callable from a Powerpoint macro/add-in? Essentially, I would like to have a piece of code in Powerpoint that generates a similar dialogue that allows a user to directly select a range of cells in an excel spreadsheet, and have the PPT macro record what that range is.
Here is an example you using
Application.InputBox opens modally. You cannot use it across workbooks.
Option Explicit Sub GetAddressFromExcel() Dim oXLApp As Object Dim Ret As Object '~~> Establish an EXCEL application object Set oXLApp = GetObject(, "Excel.Application") '~~> Show Excel oXLApp.Visible = True If oXLApp.Workbooks.Count = 0 Then oXLApp.Workbooks.Add End If On Error Resume Next Set Ret = oXLApp.InputBox("Please select Excel Range", Type:=8) On Error GoTo 0 If Not Ret Is Nothing Then MsgBox Ret.Address '~~> CLEANUP oXLApp.Quit Set oXLApp = Nothing End Sub