excel vba - How to save to SharePoint URL from MS Project using VBA? -
i writing macro in ms project prompts user input box containing active projects full file path. user able edit part of file path save new title or in new folder. macro saves ms project , ms excel version new file path. macro runs excel macro on newly created excel version. want macro save these files sharepoint url.
my code able save sharepoint. how it?
sub formatandsave() dim myvalue variant dim default dim filename string dim sharepointaddress string dim localaddress string dim wb object filename = application.activeproject.fullname 'save excel path default = filename myvalue = inputbox("your file path", default, default) if myvalue = vbnullstring msgbox ("user canceled!") exit sub end if 'show subtatsks activeproject.tasks(1).outlinehidesubtasks activeproject.tasks(1).outlineshowalltasks 'remove filters filterapply name:="all tasks" filterclear 'save project , excel under same name , path filesaveas name:=myvalue + ".mpp" filesaveas name:=myvalue + ".xlsx", formatid:="msproject.ace", map:="map 1" 'open excel file dim xlapp object dim xlwkb object set xlapp = createobject("excel.application") set xlwkb = xlapp.workbooks.open(myvalue) xlapp.visible = true 'run maro in excel file xlapp.run "benmacros.xlsm!x" 'save excel after macro runs xlwkb.save 'load sharepoint sharepointaddress = "url of folder save in" + myvalue + ".mpp" localaddress = myvalue + ".mpp" set wb = workbooks.open(localaddress) wb.saveas sharepointaddress end sub
Comments
Post a Comment