ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I call a method in VB from Excel with JUST code? (https://www.excelbanter.com/excel-programming/330352-how-do-i-call-method-vbulletin-excel-just-code.html)

Doseeson

How do I call a method in VB from Excel with JUST code?
 
I want to call a piece of code from VB while I'm in Excel, but here's the
tricky part, I don't want to use buttons or any graphical interface. I just
want to be able to call the functionality of a piece of code from a cell with
just formulas.

Something like "=abc()" to run the code in method "abc"

Is that possible?

Thanks,

Bob Phillips[_6_]

How do I call a method in VB from Excel with JUST code?
 
If the latter, it can only return a value, not manipulate the cell or the
sheet.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"K Dales" wrote in message
...
By "method" do you mean a method of a particular object? Or do you just

mean
"run a piece of code I wrote"? If the former, I don't see how you would
specify the specific object you are referring to nor be able to deal with

all
the possible return values. If the second, you are just talking about a
standard user function: write a Public Function abc() and you can use it

in a
worksheet cell.

"Doseeson" wrote:

I want to call a piece of code from VB while I'm in Excel, but here's

the
tricky part, I don't want to use buttons or any graphical interface. I

just
want to be able to call the functionality of a piece of code from a cell

with
just formulas.

Something like "=abc()" to run the code in method "abc"

Is that possible?

Thanks,




Dave Peterson[_5_]

How do I call a method in VB from Excel with JUST code?
 
Maybe you could use one of excel's events--worksheet_calculate or
worksheet_change might be useful.

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm


Doseeson wrote:

I want to call a piece of code from VB while I'm in Excel, but here's the
tricky part, I don't want to use buttons or any graphical interface. I just
want to be able to call the functionality of a piece of code from a cell with
just formulas.

Something like "=abc()" to run the code in method "abc"

Is that possible?

Thanks,


--

Dave Peterson


All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com