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
That brings up the error: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
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 isNot the best of coding but this is very old and has not been touched since its creation at the dawn of time!!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
All machines run XP SP3 with Office 11
Hope this all makes sense and that you are able to help
Thanks again
PARKY![]()




Reply With Quote