vba - No existing macros availble when Excel is opened from Outlook macro -
i have macro in outlook, , have opening excel file saved on desktop. once file open, run macro have written in excel, none of excel macros available. macros available whenever open excel other way, , macros enabled when open excel through outlook vba. question is, how make these macros available when open excel via outlook macro? please reference code below.
'pre:none 'post:excel have been opened, , macro "createpowerpoint()" ' have been run on excel document sub gimba() dim xlapp object, xlwkb object 'open excel set xlapp = createobject("excel.application") xlapp.visible = true ' can false if not wont see reaction, ' byt make sure not fail 'do not show alerts xlapp.displayalerts = false 'open excel document set xlwkb = xlapp.workbooks.open(file path goes here) 'call macro on excel document call xlapp.run("createpowerpoint") end sub
i assume macros have available stored in personal.xls workbook? if so, need load before try , launch createpowerpoint macro.
try (depends on personal workbook stored):
xlapp.workbooks.open ("c:\documents , settings\yourusernamehere\application data\microsoft\excel\xlstart\personal.xlsb") as aside, might find easier write vba code if use binding. this, need add reference excel object model, instead of using createobject, use set xlapp = new excel.application. way nice intellitype assistance.
Comments
Post a Comment