-
DLL loading Error
Hi, I am new to this so go easy on me and thanks in advanced for any replies.
The current situation is that a .dll file that has not been updated in many months has currently decided on one machine not to load! I have tried re-loading the software on numerous occasions and this has not worked, I have loaded older version of the software and the machine will accept these. The machine will run the code as a whole but there is one call from VBA
Code:
Function SetBTListener() As ButtonListener
Dim MenuBar As CommandBar
Dim ToolBar As CommandBar
Dim MenuPopup As CommandBarPopup
Dim MenuBarButton As CommandBarButton
Dim ToolBarButton As CommandBarButton
Dim Listener As ButtonListener
If IsToolBar("POW! Menu", MenuBar) Then
If IsPopup(MenuBar, "B&acktest", MenuPopup) Then
If IsSubButton(MenuPopup, "&Run Backtest", MenuBarButton) Then
If IsToolBar("POW! Toolbar", ToolBar) Then
If IsButton(ToolBar, "&Run Backtest", ToolBarButton) Then
Set Listener = New ButtonListener
Listener.Init MenuBarButton, ToolBarButton, Now()
End If
End If
End If
End If
End If
Set SetBTListener = Listener
End Function
That brings up the error:
Compile error:
Error in loading DLL
However I know that the DLL is working as it has numerous classes associated with it that are being called and used at the same run-time, it is just this one class that will not work. The code for the class is
Code:
Option Explicit
Private WithEvents mMenuBarButton As CommandBarButton
Private WithEvents mToolBarButton As CommandBarButton
Private mLastClickTime As Date
Private mSpeedOfClick As Date 'Diff
Public Sub Init(MenuBarButton As CommandBarButton, ToolBarButton As CommandBarButton, LastClickTime As Date)
Set mMenuBarButton = MenuBarButton
Set mToolBarButton = ToolBarButton
mLastClickTime = LastClickTime
mSpeedOfClick = LastClickTime ' - CDate(0)
End Sub
Private Sub mButtonClick(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
Dim tNow As Date
tNow = Now()
mSpeedOfClick = Max(0, tNow - mLastClickTime)
mLastClickTime = tNow
End Sub
Private Sub mMenuBarButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
mButtonClick Ctrl, CancelDefault
End Sub
Private Sub mToolBarButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
mButtonClick Ctrl, CancelDefault
End Sub
Public Property Get MenuBarButton() As CommandBarButton
MenuBarButton = mMenuBarButton
End Property
Public Property Get ToolBarButton() As CommandBarButton
ToolBarButton = mToolBarButton
End Property
Public Property Get LastClickTime() As Date
LastClickTime = mLastClickTime
End Property
Public Property Get SpeedOfClick() As Date 'Diff
SpeedOfClick = mSpeedOfClick
End Property
Not the best of coding but this is very old and has not been touched since its creation at the dawn of time!!
All machines run XP SP3 with Office 11
Hope this all makes sense and that you are able to help
Thanks again
PARKY:)
-
Re: DLL loading Error
Appologies, that is XP SP2
-
Re: DLL loading Error
Is this actually Visual Basic, or VBA?
-
Re: DLL loading Error
-
Re: DLL loading Error
Machines may have office v11 installed, but what version of office are you using in your DLL references? Is that version installed on the target machine?
You mentioned older version of the software. Do you mean an older version of the DLL? If so, did you uinstall the older DLL then try re-installing the new DLL?
-
Re: DLL loading Error
Office v11 is in the DLL and target machine, it is the only office version i have access to.
Yes older versions of the DLL which have definatley been removed correctly before installing the new DLL