vba - User input to select powerpoint presentation -
i've created macro helps powerpoint presentation needs updated every often.
rather going visual basic editor , importing macro each time i'd create button in separate presentation prompt user click on presentation macro needs work on. similar having excel document single button on work on workbook.
a code have similar in excel (gets user click on sheet , activates , runs macro on sheet) below.
dim uisheet worksheet on error resume next set uisheet = application.inputbox("select cell on key sheet.", type:=8).parent on error goto 0 if uisheet nothing msgbox "cancelled" elseif msgbox("you selected " & chr(34) & uisheet.name & chr(34) & ", proceed?", vbokcancel + vbquestion, "accept/reject") = vbcancel msgbox "cancelled" exit sub end if uisheet.activate
i'd prefer avoid creating add-in future users of macro (which won't me) have nice , super easy , won't have import add-ins.
or if has better idea i'm ears. how create powerpoint macro needs run in new presentation person doesn't know how use developer tab?
insert action button slide in pptm file users use. assign run macro when clicked. can part in slide show view
on insert tab, click shapes, , under action buttons (at bottom), click button shape want add. click location on slide, , drag draw shape button. in action settings dialog box, in mouse click tab. select run macro
here code use windows explorer have them select presentation, open it:
application.filedialog(msofiledialogfilepicker) .allowmultiselect = false 'only allows user select 1 file ' set title of dialog box. .title = "select file." 'put text user choose correct file 'clear filters add pptx filter .filters.clear .filters.add "powerpoint files", "*.pptx" ' can file extension filter choices ' show dialog box. if .show method returns true, ' user picked @ least 1 file. if .show method returns ' false, user clicked cancel. if .show = true fxname = .selecteditems(1) end if end set opres = presentations.open(fxname, false, false, true) 'opres variable choosen file opres.windows(1).activate 'activates presentation.
then add rest of update macro.
yes, users have open macro file, can run macro update chosen presentation easily.
Comments
Post a Comment