Two suggestions
1) First open the file with disabled macros. And then check out VBA Editor | Tools | References Check for missing links and then let us know what it is. We will take it from there.
2) For links such as the Runtime Object Library for Microsoft Scripting . I never use early binding. Early binding is the main cause of such errors. Just FYI: Early Binding creates links in advance through the VBA Editor | Tools | References I would recommend changing your code to Late Binding. Here are two examples of the same code using the Runtime Object Library for Microsoft Scripting "with early binding and late binding
EARLY TREATMENT EXAMPLE
'~~> Set Reference to "Microsoft Scripting Runtime Object Library" Sub EBExample() Dim FSO As Scripting.FileSystemObject Dim SourceFolder As Scripting.Folder Dim FileItem As Scripting.File Set FSO = New Scripting.FileSystemObject Set SourceFolder = FSO.GetFolder(SourceFolderName) For Each FileItem In SourceFolder.Files '~~> You code Next FileItem End Sub
NEXT EXAMPLE
'~~> This doesn't need a reference Sub LBExample() Dim FSO As Object, SourceFolder As Object, FileItem As Object Set FSO = CreateObject("Scripting.FileSystemObject") Set SourceFolder = FSO.GetFolder(SourceFolderName) For Each FileItem In SourceFolder.Files '~~> You code Next FileItem End Sub
Like me, I use early binding to take advantage of Intellisense, but then convert it to late binding to avoid version-specific code before distributing the code. This way the code always works. :)
IMP NOTE: Late Binding is not performed in scenarios where the destination computer does not have a corresponding DLL registered.
RECOMMENDED LINK :
Topic: Using Early Binding and Late Binding in Automation
Link : http://support.microsoft.com/kb/245115
Hope this helps
Sid
source share