本文介绍了升级后无法保存文件到2007年VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我称之为保存文件的子
I have a sub which I call to save a file
Sub SaveToFile()
maxr = Worksheets("List").Range("H1")
Worksheets("List").Range("G1:AE" & maxr).Copy
的code这是一个升级后未2007年部分原因是:
Part of the code which is failing after an upgrade to 2007 is:
With Application.FileSearch
.LookIn = "Q:\Planning Tools\Reports\"
.Filename = "Plan_" & ThisSaveTime & ".xls"
我收到运行时错误'445'对象不支持此操作,在code,那么下面继续:
I receive a runtime error '445' object doesn't support this action, the code then continues below:
If .Execute > 0 Then 'Existing Workbook
Application.Workbooks.Open ("Q:\Planning Tools\Reports\Plan_" & ThisSaveTime & ".xls")
ActiveWorkbook.Worksheets.Add
ActiveWorkbook.Sheets("Sheet1").Select
ActiveWorkbook.Sheets("Sheet1").Name = ThisPlanSaveName
Else 'No existing Workbook, so add one
Workbooks.Add 1
ActiveWorkbook.Sheets("Sheet1").Select
ActiveWorkbook.Sheets("Sheet1").Name = ThisPlanSaveName
End If
End With
......
End Sub
我不知道哪个动作失败,但任何人都可以看到,为什么?
I am not sure which action is failing but can anyone see why?
感谢
推荐答案
微软已经删除 FileSearch 从Excel 2007中对象模型
Microsoft has removed FileSearch from the Excel 2007 Object Model
有许多可能的替换例如目录并使用 FileSystemObject的
There are many possible replacements like Dir and using the FileSystemObject
请尝试以下链接:
- Excel中先生:更换类FileSearch
- MSDN社区:Application.FileSearch在Excel 2007
- Ozgrid论坛 - Rplacement的FileSearch
- Ozgrid论坛 - Application.FileSearch替换在Excel 2007中
- Execl-IT.com:替换FileSearch 李>
- Mr Excel: Replacement class for FileSearch
- MSDN Communities: Application.FileSearch in Excel 2007
- Ozgrid Forums - Rplacement for FileSearch
- Ozgrid Forums - Application.FileSearch Replacement in Excel 2007
- Execl-IT.com: Replacement for FileSearch
这篇关于升级后无法保存文件到2007年VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!