vba - MS Access 2010, Excel 2010, Windows Server 2008 R2 64-bit: SaveAs method of Workbook class failed -
services used: ms access 2010, excel 2010, windows server 2008 r2 (64-bit)
in our ms access database, wrote process exports queries .xlsx format , saves them on network drive. uses syntax:
objxl.activeworkbook.saveas filename, fileformat:=xlopenxmlworkbook
and
xlwbk.saveas filename, fileformat:=xlopenxmlworkbook
where objxl declared as:
private objxl object
and files opened via:
dim xlwbk object if objxl nothing set objxl = createobject("excel.application") end if if dir(sourcefile) = vbnullstring set xlwbk = objxl.workbooks.add else set xlwbk = objxl.workbooks.open(sourcefile) blnfileexists = true end if
this code works fine when run manually. reasonably confident code correct, i'm posting here in case.
however, need automate database have run account via scheduled task, set run if account not logged in (and account has admin rights, etc). unfortunately, when running program this, error in our logs:
"saveas method of workbook class failed."
we've verified isn't network read/write problem (it writes sorts of other files, such .txt , .pdf, fine network drive. issue appears localized excel).
we've tried fix per post: https://stackoverflow.com/a/1090864/5239568
but nothing seems working far.
finally got fixed. here worked, in case in future has same error.
we added both folders:
c:\windows\system32\config\systemprofile\desktop c:\windows\syswow64\config\systemprofile\desktop
Comments
Post a Comment