Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
I have couple of questions about VB6 COM addin
.. As quite newbee on this subject I create DLL ,reference it on Excel.But as most are being test DLL I'like to delete them rather than dereferencing. I do not know how to. .. Will I use the only file which has a extention "dll" if I want to use it on other PC as VB6 produce other files as well along with "dll" extentioned one? .. I put simple functions that I call from my excel code they work great. How can I make use of below excel VBA routine in my DLL. If Not Intersect(Target, Me.Range("C:C")) Is Nothing Then Call operatornamematch(Target) Target.Offset(, -2).Value = Worksheets("tr2007").Range("B2") Target.Offset(, -1).Value = Worksheets("tr2007").Range("B11") Target.Offset(, 3).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value & Target.Value Target.Offset(, 4).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value End if I use a wrapper to invoke DLL functions once Peter Beach suggested such as Option Explicit Private m_objMyThing As TestCOMDLL.TestClass Public Function TestWrapper1(ByVal a_nNumber as Double) As Double If m_objMyThing Is Nothing Then Set m_objMyThing = CreateObject("TestCOMDLL.TestClass") TestWrapper1 = m_objMyThing.DoubleIt(a_nNumber) End Function Thank you very much in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
Comments in line
I have couple of questions about VB6 COM addin . As quite newbee on this subject I create DLL ,reference it on Excel.But as most are being test DLL I'like to delete them rather than dereferencing. I do not know how to. Not sure what you mean by "dereferencing" If ticked under tools References in a vba project, un-tick it. If you mean unregister from Windows, remove from Com-Addins then Start/Run Regsvr32 /s, browse to the dll, add "/u" or similar with Shell but embrace the name with apostrophes Don't delete the dll before doing the above as appropriate. . Will I use the only file which has a extention "dll" if I want to use it on other PC as VB6 produce other files as well along with "dll" extentioned one? Only distribute the dll, the others are your project files . I put simple functions that I call from my excel code they work great. How can I make use of below excel VBA routine in my DLL. If Not Intersect(Target, Me.Range("C:C")) Is Nothing Then Call operatornamematch(Target) Target.Offset(, -2).Value = Worksheets("tr2007").Range("B2") Target.Offset(, -1).Value = Worksheets("tr2007").Range("B11") Target.Offset(, 3).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value & Target.Value Target.Offset(, 4).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value End if You'll need to prefix any specific Excel-VBA functions with a ref to xl If Not xlApp.Intersect(etc When you declare any Excel objects prefix with the application name Dim Target as Excel.Range and similar in procedure arguments I use a wrapper to invoke DLL functions once Peter Beach suggested such as Option Explicit Private m_objMyThing As TestCOMDLL.TestClass Public Function TestWrapper1(ByVal a_nNumber as Double) As Double If m_objMyThing Is Nothing Then Set m_objMyThing = CreateObject("TestCOMDLL.TestClass") TestWrapper1 = m_objMyThing.DoubleIt(a_nNumber) End Function This looks fine providing the dll is registered on the user's system. That occurs automatically if once loaded as a Com-addin, if not you'll need to use Regserv32. Also, TestClass should be a public class. Regards, Peter T |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
Thank you very much Peter.
Unfortunately I'd deleted my test dll's.Silly me! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
I'm not 100% sure but I think if you make identical test dll's (particularly
any public routines in public classes) in same original folders, then un-register them that would clean up any stray entries in your registry. Regards, Peter T wrote in message oups.com... Thank you very much Peter. Unfortunately I'd deleted my test dll's.Silly me! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
Typo -
If you mean unregister from Windows, remove from Com-Addins then Start/Run Regsvr32 /s, browse to the dll, add "/u" or similar with Shell but embrace the name with apostrophes - or similar with Shell but embrace the full-name with QUOTES Which means double quotes or Chr(34) when making the string Peter T "Peter T" <peter_t@discussions wrote in message ... Comments in line I have couple of questions about VB6 COM addin . As quite newbee on this subject I create DLL ,reference it on Excel.But as most are being test DLL I'like to delete them rather than dereferencing. I do not know how to. Not sure what you mean by "dereferencing" If ticked under tools References in a vba project, un-tick it. If you mean unregister from Windows, remove from Com-Addins then Start/Run Regsvr32 /s, browse to the dll, add "/u" or similar with Shell but embrace the name with apostrophes Don't delete the dll before doing the above as appropriate. . Will I use the only file which has a extention "dll" if I want to use it on other PC as VB6 produce other files as well along with "dll" extentioned one? Only distribute the dll, the others are your project files . I put simple functions that I call from my excel code they work great. How can I make use of below excel VBA routine in my DLL. If Not Intersect(Target, Me.Range("C:C")) Is Nothing Then Call operatornamematch(Target) Target.Offset(, -2).Value = Worksheets("tr2007").Range("B2") Target.Offset(, -1).Value = Worksheets("tr2007").Range("B11") Target.Offset(, 3).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value & Target.Value Target.Offset(, 4).Value = Target.Offset(, -2).Value & Target.Offset(, -1).Value End if You'll need to prefix any specific Excel-VBA functions with a ref to xl If Not xlApp.Intersect(etc When you declare any Excel objects prefix with the application name Dim Target as Excel.Range and similar in procedure arguments I use a wrapper to invoke DLL functions once Peter Beach suggested such as Option Explicit Private m_objMyThing As TestCOMDLL.TestClass Public Function TestWrapper1(ByVal a_nNumber as Double) As Double If m_objMyThing Is Nothing Then Set m_objMyThing = CreateObject("TestCOMDLL.TestClass") TestWrapper1 = m_objMyThing.DoubleIt(a_nNumber) End Function This looks fine providing the dll is registered on the user's system. That occurs automatically if once loaded as a Com-addin, if not you'll need to use Regserv32. Also, TestClass should be a public class. Regards, Peter T |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel range coding in DLL
Spot on Peter. I have restored them from recycle bin and followed your
instruction. Unregister all of them then delete.Just one stubborn dll stayed behind as a lesson to me. Thank you very much again. Very Kind Regards I'm not 100% sure but I think if you make identical test dll's (particularly any public routines in public classes) in same original folders, then un-register them that would clean up any stray entries in your registry. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Color Coding cell based on date (over a large range) | New Users to Excel | |||
Range naming cells with blank cells through coding | Excel Discussion (Misc queries) | |||
VBA & Coding a dynamic range | Excel Programming | |||
optimize coding on named range | Excel Programming | |||
Implant macro coding into ASP coding | Excel Programming |