ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pass a variable from a class module (https://www.excelbanter.com/excel-programming/278632-pass-variable-class-module.html)

pk

Pass a variable from a class module
 
Perhaps, Tom Ogilvy or someone could help me with this,
please?

I am attempting to pass a variable (a date, right now a
variant: should I change this?) from a public sub in a
class module (a sheet module) in one file to a subroutine
residing in another file.

It isn't working. Is it not possible or am I missing the
boat? Here is the code in the sheet module:

Public Sub Calendar1_DblClick()
xDate = Calendar1.Value
ActiveSheet.OLEObjects("Calendar1").Delete
Application.Run "Calendar!Common_Receive_Date(xDate)"
End Sub

The objective is to pass the date from the calendar
control to the other file and simultaneously kick off a
program there. Possible?

Thanks in advance for your example code and assistance...


Tom Ogilvy

Pass a variable from a class module
 
Application.Run "Calendar!Common_Receive_Date", xDate

Arguments to run are the macro to run, then a list of argument values for
that macro.

I don't know how successful you will be deleting the calendar control from
an event of the calendar control.

I think I would move that line to the end and probably comment it out for
testing the run command - until I was sure the run command was working.

--
Regards,
Tom Ogilvy


"pk" wrote in message
...
Perhaps, Tom Ogilvy or someone could help me with this,
please?

I am attempting to pass a variable (a date, right now a
variant: should I change this?) from a public sub in a
class module (a sheet module) in one file to a subroutine
residing in another file.

It isn't working. Is it not possible or am I missing the
boat? Here is the code in the sheet module:

Public Sub Calendar1_DblClick()
xDate = Calendar1.Value
ActiveSheet.OLEObjects("Calendar1").Delete
Application.Run "Calendar!Common_Receive_Date(xDate)"
End Sub

The objective is to pass the date from the calendar
control to the other file and simultaneously kick off a
program there. Possible?

Thanks in advance for your example code and assistance...





All times are GMT +1. The time now is 01:46 PM.

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