Use Access VBA to check-out an Excel doc from Sharepoint -


i have rather odd situation, below code can checkout file sharepoint excel...

private sub checkoutfromsp() dim loc string loc = "location"  if workbooks.cancheckout(loc) = true workbooks.checkout loc end if 

however how translate access? receive error "this document cannot checked out" following code?

dim objxl excel.application dim loc string  loc = "location" objxl = new excel.application  if objxl.workbooks.cancheckout(loc) = true objxl.workbooks.checkout loc end if 

reason checkout via access there few pieces of data need dropped excel access, excel file on sharepoint need checkout/checkin submit changes.

open document excel instance before checking out , should work you:

dim objxl excel.application dim objwb excel.workbook 'new dim loc string  loc = "location"  set objxl = new excel.application  'make sure use set here  if objxl.workbooks.cancheckout(loc) = true     set objwb = objxl.workbooks.open(loc)  'new     objxl.workbooks.checkout loc end if 

when check workbook in line objwb.checkin, excel automatically closes workbook object.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -