Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6957003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:56:34+00:00 2026-05-27T14:56:34+00:00

I am attempting to send a message via sockets from VBA. I have made

  • 0

I am attempting to send a message via sockets from VBA. I have made static .NET classes to do this (for use in other .NET applications).

How do I use them in VBA?

I found VBA syntax for using shell32.dll functions that look like this, but I can not do this as when I build my library geared for COM use I can’t have static routines (and research says COM doesn’t like static fields). How did Shell32 do it?

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long

I figured out how to do it by having VBA instantiate a class and call the routine from that, but I can only implement this by adding a reference to my .DLL in VBA’s References section (which means the end user has to have it installed in a static place).

TL;DR; How do I use static routines made in C# .NET in VBA by having the library in the same directory as the excel file? (.xlsm, or .xlsb)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:56:35+00:00Added an answer on May 27, 2026 at 2:56 pm

    You cannot pass class objects between VBA and a DLL, only COM objects. You would need to wrap your class in a COM object, with COM methods and properties rather than class methods and properties.

    You can also call DLL methods as you provide in the example – those are just functions, not class functions. You would need to (in C#) create a function that then created the class and called the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use the data series from this example no longer passes the JSONLint
I'm attempting to send a .proto message from an iPhone application to a Java
I am attempting to send a Point-to-Point JMS message from an oracle database stored
I am attempting to send an email using VB.NET. There are two requirements: The
I'm attempting to send HTML formatted emails using C# 3 via Outlook.MailItem Outlook.MailItem objMail
I am new to WINAPI and have figured out how to send a message
I am attempting to use JSON to send data between the browser and my
I am attempting to send a signal out over the session message bus. I
I am attempting to create a simple app that can send a text message
While attempting to send a message for a queue through the BeginSend call seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.