Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Excel return multiple correct answers? sam Excel Worksheet Functions 6 March 5th 08 09:41 PM
I need to return one of three answers in a cell Kath Excel Worksheet Functions 4 July 3rd 06 10:36 AM
How to look up a value in list & return multiple answers Jerry Excel Discussion (Misc queries) 0 February 22nd 06 08:13 PM
Can VLOOKUP return multiple answers based on several identical lo. jddtct Excel Worksheet Functions 3 January 11th 05 07:03 AM
Functions returning multiple answers Clint[_4_] Excel Programming 2 July 26th 04 06:55 PM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"