×

Loading...
Ad by
Ad by

Thank you. Please see my code

本文发表在 rolia.net 枫下论坛I use this Macro to open over 30 files in one folder, this error only happens when open one of these files (all files have identicla formate and layout).

Here is my code,

For j = 1 To NumFiles
Application.ScreenUpdating = False

SiteFilePathname = Sheets("AllDataSheet").Cells(5 + j, "C").Value
SiteFileName = Sheets("AllDataSheet").Cells(5 + j, "D").Value
Workbooks.Open FileName:=SiteFilePathname, UpdateLinks:=0

'Using Site File Name as Site Name Code, a very lengthy formula!!
Sheets("menu").Cells(6, "I").Value = "=LEFT(MID(CELL(""FILENAME"",F9),FIND(""["",CELL(""FILENAME"",F9))+1,FIND(""]"",CELL(""FILENAME"",F9))-FIND(""["",CELL(""FILENAME"",F9))-1),LEN(MID(CELL(""FILENAME"",F9),FIND(""["",CELL(""FILENAME"",F9))+1,FIND(""]"",CELL(""FILENAME"",F9))-FIND(""["",CELL(""FILENAME"",F9))-1))-4)"

Call CheckIfIsTempFile
Next

End of code更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / Could anyone help me out of the Excel 2003 Automation error
    After upgrading from Excel 97 to Excel 2003, I get the
    following error message when executing an Excel Macro . . . "automation error.
    unspecified error" . After the error, the file that related with this error will never openable.

    Many thanks if anyone can help,
    • Can you post the macro?Otherwise it's very hard to help.
      • Thank you. Please see my code
        本文发表在 rolia.net 枫下论坛I use this Macro to open over 30 files in one folder, this error only happens when open one of these files (all files have identicla formate and layout).

        Here is my code,

        For j = 1 To NumFiles
        Application.ScreenUpdating = False

        SiteFilePathname = Sheets("AllDataSheet").Cells(5 + j, "C").Value
        SiteFileName = Sheets("AllDataSheet").Cells(5 + j, "D").Value
        Workbooks.Open FileName:=SiteFilePathname, UpdateLinks:=0

        'Using Site File Name as Site Name Code, a very lengthy formula!!
        Sheets("menu").Cells(6, "I").Value = "=LEFT(MID(CELL(""FILENAME"",F9),FIND(""["",CELL(""FILENAME"",F9))+1,FIND(""]"",CELL(""FILENAME"",F9))-FIND(""["",CELL(""FILENAME"",F9))-1),LEN(MID(CELL(""FILENAME"",F9),FIND(""["",CELL(""FILENAME"",F9))+1,FIND(""]"",CELL(""FILENAME"",F9))-FIND(""["",CELL(""FILENAME"",F9))-1))-4)"

        Call CheckIfIsTempFile
        Next

        End of code更多精彩文章及讨论,请光临枫下论坛 rolia.net