MS Access VBA File Dialog Crashing -
from ms access generating several ms access workbooks. via following code getting desired save location of workbooks. following code working without issues few days ago. abruptly fails no error number. ms access crashes , prompt restart ms access , backup file automatically created of ms access project working on.
strangely code works fine if step through debugger. not working @ full speed.
update 1: if falling save_location call works.
private sub make_report() ' todo#: change late binding when working dim strsavelocation string dim xl excel.application dim wb excel.workbook strsavelocation = save_location("g:\group2\dev\z_report") set xl=new excel.application ' workbook stuff xl strsavelocation = strsavelocation & "\report_name.xlsx" wb.saveas strsavellocation, xlopenxmlworkbook end ' xl set xl=nothing end sub if call save_location function abruptly crashes ms access. doesn't throw error or anything. crashes.
private sub make_report() ' todo#: change late binding when working dim strsavelocation string dim xl excel.application dim wb excel.workbook set xl=new excel.application ' workbook stuff xl ' call save_location inside of xl procedure strsavelocation = save_location("g:\group2\dev\z_report") strsavelocation = strsavelocation & "\report_name.xlsx" wb.saveas strsavellocation, xlopenxmlworkbook end ' xl set xl=nothing end sub by moving save_location call inside excel.application work string fails. don't understand why.
private function save_location(optional byval initialdir string) string on error goto err_trap dim fdialog object dim blmatchinidir boolean set fdialog = application.filedialog(4) ' msofiledialogfolderpicker fdialog .title = "select save location" if not (initialdir=vbnullstring) .initialfilename = initialdir end if if .show = -1 ' item selected save_location = .selecteditems(1) end if end set fdialog = nothing exit_function: exit function err_trap: select case err.number case else debug.print err.number, err.description stop resume end select end function - actions tried:
- decompile project , recompile
- create new ms access project , import objects
- compact , repair
- reset reference
- notes:
- i using client's system ,
- i don't know of system updates
- client's system virtual desktop via vmware
- office 2013
- windows 7 pro
Comments
Post a Comment