References" But now the problem...">

Using system.drawing in vba

I want to use system.drawing.dll in a VBA macro. I added it as a reference "Tools-> References" But now the problem starts, I cannot figure out how to use and call methods in the system.drawing.dll file. I access System_Drawing but it ends there. I can declare in VBA

         Dim image1 as Bitmap
         Dim ImageFunc as System_drawing.Image

      

But then I cannot download (or install ...?) The image in image1.

I did the same thing in Visual Basic 2010 and it works great. See Strike for code

Imports System.Drawing
....
        Dim image1 As Bitmap = CType(Image.FromFile(Path, True), Bitmap)
        image1.MakeTransparent(Color.White)
        image1.Save(Path)
        image1.Dispose()

      

How do I apply the same code but in VBA? I've tried different functions Declare, Set, etc., but nothing works. It gives me pleasure to skip the basics, even though I've googled and read about how to use C dlls in VBA.

+3


source to share





All Articles