• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Creating and Using O2 DLL in VBA EXCEL

Started by Eduardo Jorge, June 20, 2018, 10:08:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Eduardo Jorge

in parts I will relate the experience I am having with this subject

my intention is to use excel just as visual interface.
to abandon excel I have to learn how to handle files and create interfaces,
  I would certainly love to use the graphs generated with the examples opengl

Eduardo Jorge

within VBA in a module
an important point is the declaration of the function that is in the DLL, and passing of parameters

can make a statement
Private Declare = can only be called from within the module that is declared
Public Declare = can be called from any module
Can be
Sub = can have parameters Byval Byref, if you can use Byref to retune value
Function = can return values

Public Declare Sub Function_Name Lib "D:\worksheets\Statistics_1.0.dll" (ByRef Table  As Long)

to declare the DLL that is inside the worksheet folder dynamically, it can be used like this
Private Declare Function Function_Name Lib "Statistics_1.0.dll" (ByRef Table As Long) as Long
but have to use some code to use the function


Sub DLLCALL()

     Dim CurrentPath As String
     CurrentPath = CurDir()

     ChDir            ThisWorkbook.Path    ' <<<--- grab the folder where the worksheet is
     ChDrive Left( ThisWorkbook.Path , 1)' <<<--- get the driver's letter

Call Statistics(Sort(1, 1)) '   <<< ---   calls the DLL function

     ChDir CurrentPath:
     ChDrive Left(CurrentPath, 1)