Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing Custom Class Variables through Functions


I am trying to pass a custom class through a function, I can watch th
variable, it gets passed to the function but when it goes to b
returned I get this error,
*Object doesn't support this property or method (Erro
438)*
Am I doing the syntax wrong or something, here is the function.
Function ChangeOffSet(SSheet As SSched)
' This Sets the Offset of the Variables
If (SSheet.WorkMonth + SSheet.DaysOn)
SSheet.DaysOff < 0 Then
SSheet.WorkMonth = (SSheet.WorkMonth
SSheet.DaysOn)
Else
SSheet.WorkMonth = SSheet.WorkMonth
(SSheet.DaysOn)
End If

ChangeOffSet = SSheet

End Function

When I call it It looks like this
I use the same variable names.
*SSheet = ChangeOffSet(SSheet)*

Thanks a bunc

--
Xiaze
-----------------------------------------------------------------------
Xiazer's Profile: http://www.excelforum.com/member.php...fo&userid=3158
View this thread: http://www.excelforum.com/showthread.php?threadid=54374

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Passing Custom Class Variables through Functions

Hi,

As it is an object you need to use the Set command.

Set SSheet = ChangeOffSet(SSheet)

and in the function

set ChangeOffSet = SSheet

Cheers
Andy

Xiazer wrote:
I am trying to pass a custom class through a function, I can watch the
variable, it gets passed to the function but when it goes to be
returned I get this error,
*Object doesn't support this property or method (Error
438)*
Am I doing the syntax wrong or something, here is the function.
Function ChangeOffSet(SSheet As SSched)
' This Sets the Offset of the Variables
If (SSheet.WorkMonth + SSheet.DaysOn) -
SSheet.DaysOff < 0 Then
SSheet.WorkMonth = (SSheet.WorkMonth +
SSheet.DaysOn)
Else
SSheet.WorkMonth = SSheet.WorkMonth +
(SSheet.DaysOn)
End If

ChangeOffSet = SSheet

End Function

When I call it It looks like this
I use the same variable names.
*SSheet = ChangeOffSet(SSheet)*

Thanks a bunch



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing Custom Class Variables through Functions


Thanks Andy, your my hero!


--
Xiazer
------------------------------------------------------------------------
Xiazer's Profile: http://www.excelforum.com/member.php...o&userid=31581
View this thread: http://www.excelforum.com/showthread...hreadid=543749

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
Passing Variables through Custom Dialog Boxes Xiazer[_8_] Excel Programming 7 May 16th 06 10:37 PM
Passing multiple variables through functions Xiazer[_4_] Excel Programming 2 April 25th 06 06:56 PM
Passing variables from one sub to another Yasha Avshalumov Excel Programming 4 August 19th 05 04:52 PM
Passing Variables Paula[_3_] Excel Programming 1 August 23rd 04 06:55 PM
passing variables Squid[_2_] Excel Programming 1 July 27th 04 03:47 AM


All times are GMT +1. The time now is 05:40 PM.

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

About Us

"It's about Microsoft Excel"