我最近将Office应用程序更新为365.我在VBA中收到错误。 “编译错误:必须更新此项目中的代码才能在64位系统上使用。”如何将代码从32位更改为64位?
public void deleteFilesOlderThanNdays( int Ndays, String aFolder) throws
ParseException{
File directory = new File(aFolder);
if(directory.exists()){
File[] logFiles = directory.listFiles();
for (File log: logFiles) {
String name= log.getName();
//Pattern dateFind = Pattern.compile("\\d\\{0,10}");// or
Pattern dateFind = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
Matcher dateSearch =dateFind.matcher(name);
while(dateSearch.find()){
String logDate = dateSearch.toString();
SimpleDateFormat format= new SimpleDateFormat("yyyy.mm.dd");
Date date= format.parse(logDate);
long cutOffPoint = System.currentTimeMillis() - (Ndays* 24*60*60*1000);
if(date.getTime()< cutOffPoint){
log.delete();
}
}
}
}
}
答案 0 :(得分:1)
在为64位准备Access数据库时,我只是遇到了这个问题,并且发现了用于编译器指令的良好代码模板,以确保代码可以在多个版本中工作:
#if Vba7 then
' Code is running in the new VBA7 editor
#if Win64 then
' Code is running in 64-bit version of Microsoft Office
#else
' Code is running in 32-bit version of Microsoft Office
#end if
#else
' Code is running in VBA version 6 or earlier
#end if