Step by Step explanation on VBA DLL

You are not quite sure where to place your question or issue? You want to suggest a new forum or want to provide feedback to the board itself?

Try here!
shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Step by Step explanation on VBA DLL

Post by shank » Thu 5. Sep 2019, 11:37

Thank you Mr. Jetter for activating my account.
I am facing difficulty in utilizing the VBA DLL feature of memBrain. As instructed in Help section of memBrain, I downloaded the "VBA DLL Example" from website and followed the steps mentioned within test-box.
I am using 64-bit system therefore, I copied MemBrainDLL.dll into C:\Windows\sysWOW64. After that, I started MS Excel and from developer tab I started UserForm1 which was blank. Pressed F5 but nothing happened.

I am doing something wrong but not able to figure it out. Please help me.
It's kind of urgent.

Shashank

User avatar
TJetter
Posts: 318
Joined: Sat 13. Oct 2012, 12:04

Re: Step by Step explanation on VBA DLL

Post by TJetter » Sat 7. Sep 2019, 15:38

Thanks for the request. I will try to look into this asap.
At the moment I would assume that it has something to do with access rights on your machine.
- What version of MS Office are you using?
- When you double-click on the entry 'UserForm1' is this what you see? Or is the form empty (i.e. without buttons on it)? May be you can post a screen shot?
MBInputQualifyExcel2007.png
(25.08 KiB) Not downloaded yet
- Instead of pressing F5: Can you identify the green <Play> button instead on your screen and press it?
Thomas Jetter

shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Re: Step by Step explanation on VBA DLL

Post by shank » Mon 9. Sep 2019, 06:09

Hi,

I am using MS Office 2010 version.
As far as "userform1" is concerned, I have to insert the userform1 from INSERT tab. I do not see the entry "UserForm1" there by default as shown in the screenshot shared by you.

What kind of permission, I am supposed to give in order to run this smoothly ?
____________
Shashank

User avatar
TJetter
Posts: 318
Joined: Sat 13. Oct 2012, 12:04

Re: Step by Step explanation on VBA DLL

Post by TJetter » Mon 9. Sep 2019, 09:33

shank wrote:
Thu 5. Sep 2019, 11:37
After that, I started MS Excel and from developer tab I started UserForm1 which was blank
Just to be sure:
When you say: "I started MS Excel" means that you opened the file "MBInputQualifyExcel2007.xls" from the downloaded file "MBInputQualify.zip", right?
This file should already contain all the buttons on UserForm1 and also the code behind.
In my (German) version of Excel 2007 the tab is mentioned "Entwicklertools" which probably is "developer" tab in your English version. OK so far.
If I then choose "Visual Basic" on this tab I end up in the code editor and can see the code and also the UserTab1 which is pree-filled with the buttons.

Do you get a macro safety alert message when oping the file? Please check out your MS office trust center settings as described here:
https://support.office.com/en-us/articl ... n-US&ad=US
Ensure that either all macros are enabled or that you allow execution of the macros in the opened file (i.e. on a file by file basis).
Important test: When you select the trust center setting "Disable all macros with notification" and then open the file "MBInputQualifyExcel2007.xls" you must notice that a safety alert is presented by Excel. If this does not happen then your file MBInputQualifyExcel2007.xls does not contain any macros. May be some virus filter has removed the macros during download?

Also:
Is it possible that some of the following settings prohibit opening VBA content on your system? I don't have these settings in my Office 2007 but may be you have it in your 2010?
Thomas Jetter

shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Re: Step by Step explanation on VBA DLL

Post by shank » Tue 10. Sep 2019, 06:06

Mr. Jetter,

I figured out the permissions it required. But got stuck at something else.
It seems that we need to change the code a little bit for 64-bit (that's what program is asking us to do).
I have attached a screenshot for the error I am getting while running the code.
Attachments
MemBrain.JPG
(217.41 KiB) Not downloaded yet

User avatar
TJetter
Posts: 318
Joined: Sat 13. Oct 2012, 12:04

Re: Step by Step explanation on VBA DLL

Post by TJetter » Tue 10. Sep 2019, 08:07

There's a German thread on this already in the forum where the same issue was solved:
https://www.membrain-nn.de/forum/viewto ... ?f=3&t=506
Can you try to find your way with the google tranlated version as follows?
https://translate.google.de/translate?h ... %26t%3D506

Most important post here are:
When starting the macro in Excel my Excel reports (from Office 2016) first that the "Declare" instructions are not correct for 64bit, so I have replaced all with "Declare PtrSafe".
I've now taken a closer look at the 64-bit version of the dll and notice that the functions are obviously different - unlike the 32-bit version:

The functions start in this case only with ONE underscore and the supplement @xx is omitted.

Example:
32 bits:
__MB_AddHidden @ 12

64 bits:
_MB_AddHidden
Also this:
under 64 bit Excel the file 'MBDllWrapper64.dll' has to be loaded, not 'MemBrainDll.dll'. That means it has to be replaced everywhere in the VBA code. If it still does not work, please copy the dll file into the same directory where the Excel file is located.
Meanwhile I will try to catch up on this with the original topic poster and try to acquire the correct VB Declarations file that he created then. Unfortunately I don't have a 64 bit MS Office available to try things by myself.

Kind regards
Thomas Jetter

shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Re: Step by Step explanation on VBA DLL

Post by shank » Tue 10. Sep 2019, 11:25

I changed the code as suggested and program did run for a while only to end up giving another error:
Run time error
File MemBrainDLL.dll not found

(Screenshot is attached herewith)

However, I am going through this exercise because I need to know the relative importance of variables as mentioned in excel file within textbox:
Thus it is possible to check the influence of every input neuron to the output neurons of the net, i.e. this can be a way to identify which input neurons are more significant resp. which input neurons could be good candidates for being optimized away in a neural net.
If this can be done without VBA DLL, I would be more than happy to know the method.
Attachments
MemBrain_Err_2.JPG
(109.13 KiB) Not downloaded yet

User avatar
TJetter
Posts: 318
Joined: Sat 13. Oct 2012, 12:04

Re: Step by Step explanation on VBA DLL

Post by TJetter » Tue 10. Sep 2019, 22:09

See below:

Have you replaced the string "MemBrainDll.dll" by "MBDllWrapper64.dll" in all locations and copied the dll file to the same dir where the Excel is located?
The error message still talks about "MemBrainDll.dll".
Also this:
under 64 bit Excel the file 'MBDllWrapper64.dll' has to be loaded, not 'MemBrainDll.dll'. That means it has to be replaced everywhere in the VBA code. If it still does not work, please copy the dll file into the same directory where the Excel file is located.
You can perform the sensitivity analysis for the inputs also via a MemBrain script (i.e. without the dll). Here's the link to the corresponding forum post on this:
https://www.membrain-nn.de/forum/viewto ... f=14&t=511

Just copy the script to your local disk (ideally to a separate directory on your machine). Load your trained net in MemBrain. Run the script via MemBrain menu <Scripting><Execute Script...>.
Thomas Jetter

shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Re: Step by Step explanation on VBA DLL

Post by shank » Wed 11. Sep 2019, 09:13

Made the changes and run the program.
After adding the node to program, it resulted into error
result = MB_LoadNet(fileName)
(Screenshot attached)
Attachments
MemBrain_Err_3.JPG
(75.26 KiB) Not downloaded yet

shank
Posts: 8
Joined: Wed 4. Sep 2019, 07:24

Re: Step by Step explanation on VBA DLL

Post by shank » Wed 11. Sep 2019, 11:41

Scripting is successful.
I got to see the pattern viewer and there are different graphs plotted...
But, I might need a little help on interpretation...

Post Reply