开发者

HELP: application defined or object defined error when saving a workbook

I get the application defined or object defined error when I save an excel file. I get an error at line: "wbk.SaveAs FPat开发者_开发知识库h"

Here is my code:

Dim wbk As Workbook, FPath As String

Set wbk = Workbooks.Open("\\network\drive\Template.xlsm", False, ReadOnly:=True,       IgnoreReadOnlyRecommended:=True)

FPath = "\\network\drive\Saved_Files\" & _
"File Number - " & ThisWorkbook.Worksheets("Sheet1").Range("A1").Value & ".xlsm"

With Worksheets("Sheet1")
.Range("A2").Value = Test....
End With

***wbk.SaveAs FPath***

wbk.Close True
Set wbk = Nothing


I had this problem the other day too, You can not save to a network drive like that. It has to be mapped as a drive letter for it to work.

At least I couldn't find a way around it while tinkering with it. Excel does not seem to like network drives as a path name.

EDITED : Tim is right, my problem I stated above is a problem that just requires a hot fix from Microsoft. Shouldn't be on all machines.

Maybe this link could help though, they are describing the same type of issue. See the first comment, a lot of people seemed to have success with the code inside.

http://www.dailydoseofexcel.com/archives/2006/06/21/unc-path/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜