0

someone recently decided to move all Excel 2010 to Office 365... 64 bits Recently they realized that there were some ActiveX, legacy DLLs (written in vb6 !!) that were used in VBA. Of course they won't run in Office 365, so we are trying to migrate them to .NET 4.5. We did a small sample dll in C# (returning a string). It works fine with Excel 2010, doesn't in 365. (Error 429). Now the question(s) are : 1. Should it work / is possible to make it work ? 2. If so how ? 3. If not, what is proper way of doing it (preferably without dumping the VBA code) ?

Ok, the code in vba is very simple

like

Dim x as New Element365.Connection
Dim s as String
s = x.get_String
MsgBox s

and the code in c# just as well...(The dll's name/namespace is Element365)

public class Connection {

public Connection() {
}

public String get_String() {
return "This is a Test"
}
}

Thanks in advance

gougoul
  • 21
  • 4
  • maybe to make it clear, we register the dll using regasm, and use it by adding a reference (the component is found) in VBA. However when attempting to use it… it fails ! – gougoul Dec 19 '18 at 16:26
  • Just to clarify, the Office 365 is a desktop install? If not, consider porting the code to TypeScript / Office-JS. – Mathieu Guindon Dec 19 '18 at 16:39
  • Granting that there are reasons blocking you from considering Office-JS, there isn't enough information to help you with the question as-is. For one thing, we need to see the code you're using in both the C# dll and the VBA to read that string in order to provide assistance in what is going wrong. There are several reasons why it might not work even though you apparently were able to register the DLL. – this Dec 19 '18 at 17:16
  • Ok, I added roughly the code. For the DLL, I Checked the COM stuff in the project properties. I honestly don't know If anything else is required. Maybe I'll try this one out [link](https://stackoverflow.com/questions/6340041/using-a-c-sharp-dll-inside-excel-vba) – gougoul Dec 19 '18 at 18:37

1 Answers1

0

Ok simply put, and as mentioned, the DLL used to work in Excel 2010...

So this wasn't the issue. So it was all down to using regasm in 64 bit…

Fixed it.

Thanks for your comments anyway.

gougoul
  • 21
  • 4