title: What causes "Method ~ of object ~ failed" in a VB6 application?
body: <p>I am working on an old VB6 app and have recently added the Siemens OPC component. When running in VB6 debugger I have no problems.</p>
  
  <p>I then created a deployment package (Siemens OPC dlls included in the package) and deployed the app on the same PC. I then get the following error message when accessing the OPC object:</p>
  
  <p>'Method ~ of object ~ failed'</p>
  
  <p>Can anyone suggest what might be causing this or what I can do to get more information?</p>
  
  <p><strong>UPDATE</strong>
  I am aware of other questions around this error message. What is puzzling me here is that there are no problems when using the VB debugger. The problems occur after deployment - even on the same machine. I would have thought that all the components remain registered and available.</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>Public Sub InitialiseOPC(ServerIP As String, OpcServerName As String, BaseAddress As String)
      On Error GoTo ProcError
      IsInitialised = False
  
      Set MyOpcServer = New OPCServer
      Dim LocalServers
  
      LocalServers = MyOpcServer.GetOPCServers(ServerIP)
      ....
  </code></pre>
  
  <p>The error occurs when GetOPCServers is called. This is the first time the OPC component is accessed.</p>
  
  <p>Is there any way to trace what VB is doing at this time (e.g. dll loading) ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I tried deploying the Siemens dlls to the application folder instead of the default locations and this error message no longer appears.  </p>