English 中文(简体)
B. 工作手册中的错误
原标题:Compile error during workbook open
  • 时间:2012-01-12 21:36:44
  •  标签:
  • excel
  • vba

我有一份使用某种类型的工作手册,请打电话给它,该手册载于我的参考资料中定义的一个单元(DL)。

我制定了一些在《工作手册》(Open())中呼吁的法典,如果它没有列入参考文件清单的话,将添加提及《反歧视法》的内容。 因此,我可以向某人提供工作手册,而他们却不得不手提。

我的问题是,当我在《工作手册》执行之前(并且可以确定保留)开放《工作手册》时,我就被扔进了不定的T类的空洞中,没有界定。 绝无dding。

这似乎只是一个小的鸡蛋。 前面有人看到这一点吗? 你们是如何固定的?

问题回答

与其他人一样,如果你在<代码>Workbook_Open之前不增加对《刑法》的提及,那么你必须使用过时的约束力来连接《刑法》中的 st脚。

然而,我认为你正以这种错误的方式对待。 在<代码>Workbook_Open中不提及DL,而是已经参考并核对了<代码>。 IsBroken. 然后,你可以制定法典,来做确定被打破的参照点所需要的一切。

这有利于早期约束,而如果对《刑法》的提及被打破,你就没有获得同样的汇编错误。

NOTE: You can still get compile errors, but they won t be for the missing DLL. While you have a broken reference, any use of functions from the VBA Strings module will trigger a compile error if the function isn t prefaced with Strings. For example, the following code will cause a compiler error before Workbook_Open runs if you have any broken references.

Private Sub Workbook_Open()
   Dim r As Reference
   For Each r In ThisWorkbook.VBProject.References
      If r.IsBroken Then
         MsgBox "Found broken reference." & vbCrLf _
              & Mid(r.FullPath, InStrRev(r.FullPath, "") + 1)
      End If
   Next r
End Sub

编号:MidInStrRev,

MsgBox "Found broken reference." & vbCrLf _
     & Strings.Mid(r.FullPath, Strings.InStrRev(r.FullPath, "") + 1)




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...