Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA and VB6 functions return different answers?
I have a working set of classes and routines in Excel 2003 written in VBA.
They return the correct answers. The various functions do goal seeking and reading and changing various cells in my spreadsheet. I created an activex dll in VB6 and moved the code over. I included the Excel object library and other required bits and pieces. The problem is that the VB6 routines return into Excel a completely different answer. One of the functions returns a double which should be 0.14426% and instead returns 0.00028%. All of the code moved cleanly into VB6 with the exception of routines which acted upon Excel cells (goto cells, pasting cell values from the .dll, etc.). All of these items take the array or cell and pass it into VBA to be dropped into the spreadsheet. Is a double not a double? Any pointers? Thanks all Andrew I'm not even sure how to go about debugging a .dll called by Excel. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA and VB6 functions return different answers?
It would sure be helpful to see your formula and the VBA code you came up
with to duplicate it. Rick "Andy" wrote in message ... I have a working set of classes and routines in Excel 2003 written in VBA. They return the correct answers. The various functions do goal seeking and reading and changing various cells in my spreadsheet. I created an activex dll in VB6 and moved the code over. I included the Excel object library and other required bits and pieces. The problem is that the VB6 routines return into Excel a completely different answer. One of the functions returns a double which should be 0.14426% and instead returns 0.00028%. All of the code moved cleanly into VB6 with the exception of routines which acted upon Excel cells (goto cells, pasting cell values from the .dll, etc.). All of these items take the array or cell and pass it into VBA to be dropped into the spreadsheet. Is a double not a double? Any pointers? Thanks all Andrew I'm not even sure how to go about debugging a .dll called by Excel. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA and VB6 functions return different answers?
Andy,
You can debug your code by adding a windows project with a Sub Main to your dll project. In that project you can have a few lines of code that use getobject(excel) to define the excel instance and call the dll. The combination of the activex and windows project are called a project group. hth, Doug "Andy" wrote in message ... I have a working set of classes and routines in Excel 2003 written in VBA. They return the correct answers. The various functions do goal seeking and reading and changing various cells in my spreadsheet. I created an activex dll in VB6 and moved the code over. I included the Excel object library and other required bits and pieces. The problem is that the VB6 routines return into Excel a completely different answer. One of the functions returns a double which should be 0.14426% and instead returns 0.00028%. All of the code moved cleanly into VB6 with the exception of routines which acted upon Excel cells (goto cells, pasting cell values from the .dll, etc.). All of these items take the array or cell and pass it into VBA to be dropped into the spreadsheet. Is a double not a double? Any pointers? Thanks all Andrew I'm not even sure how to go about debugging a .dll called by Excel. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA and VB6 functions return different answers?
It sounds like one of those "something's wrong with my car, what is it" type
questions! Extremely unlikely to be some fundamental difference between VBA / VB6. All of the code moved cleanly into VB6 with the exception of routines which acted upon Excel cells (goto cells, pasting cell values from the .dll, etc.). Normally it's not necessary to use Activate and/or Select, if that's what you mean by 'goto', Probably all the code can be in the dll with the vba routine just a wrapper. I'm not even sure how to go about debugging a .dll called by Excel. If your VBA is calling the dll, via a reference to a public class in the dll, you should be able to step back & forth between the two projects. In the VB6 IDE press F5, or better still Ctrl-F5, then F8 in VBA (or place break points in either project then F8). Initially arrange windows so that Excel and both VBIDE's are visible and you can see the desktop in the middle of the screen (to see and dismiss a certain annoying message that is apt to appear). If the dll is a com addin, put a break on any relevant entry points, with Excel closed press Ctrl-F5, then start Excel. In VBA Tools / references you may notice the ref switch between the .dll and the .vbp. Regards, Peter T "Andy" wrote in message ... I have a working set of classes and routines in Excel 2003 written in VBA. They return the correct answers. The various functions do goal seeking and reading and changing various cells in my spreadsheet. I created an activex dll in VB6 and moved the code over. I included the Excel object library and other required bits and pieces. The problem is that the VB6 routines return into Excel a completely different answer. One of the functions returns a double which should be 0.14426% and instead returns 0.00028%. All of the code moved cleanly into VB6 with the exception of routines which acted upon Excel cells (goto cells, pasting cell values from the .dll, etc.). All of these items take the array or cell and pass it into VBA to be dropped into the spreadsheet. Is a double not a double? Any pointers? Thanks all Andrew I'm not even sure how to go about debugging a .dll called by Excel. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can Excel return multiple correct answers? | Excel Worksheet Functions | |||
I need to return one of three answers in a cell | Excel Worksheet Functions | |||
How to look up a value in list & return multiple answers | Excel Discussion (Misc queries) | |||
Can VLOOKUP return multiple answers based on several identical lo. | Excel Worksheet Functions | |||
Functions returning multiple answers | Excel Programming |