Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9052733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:15:12+00:00 2026-06-16T13:15:12+00:00

I have made the class named ‘class1’: Private ka As Variant Private ra As

  • 0

I have made the class named ‘class1’:

Private ka As Variant
Private ra As Variant

Public Property Get kolom() As Variant
    kolom = ka
End Property

Public Property Get rij() As Variant
    rij = ra
End Property

Public Property Let kolom(value As Variant)
    ka = value
End Property

Public Property Let rij(value As Variant)
    ra = value
End Property

Then in a normal module sub I defined the variables:

Public Sub MakeArray(OutputSheet As Variant)
Dim igeg As Class1
Set igeg = New Class1
igeg.kolom = 47
igeg.rij = 559
End Sub

Now in a new sub I want to get the values 47 and 559 but I cannot figure out how to do that. I tried the following but ik gives no value:

sub test()
Dim igeg As Class1
newkolom = igeg.kolom
Msgbox igeg.kolom
End sub

or tried the following without result:

Public Function Test1() As Class1
Set Test1 = New Class1

End Function

Public Sub test()
Dim newigeg As Class1
Set newigeg = Test1

Msgbox igeg.kolom
End sub

Actually the idea is that I would like to use the value calculated in sub 1 in another sub. How can i get the value from the class module or are there better ways. Don’t want to use call sub(value).

Thank you for your help in advance!

Amir

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:15:13+00:00Added an answer on June 16, 2026 at 1:15 pm

    You call makeArray() within test(). Why don’t you use makeArray() as a function ? Because Function can return an object/value. It’s much recommended to use a function in your case.

    Try the following:

    Public Function MakeArray(ByRef OutputSheet As Variant) as Class1
    Dim igeg As Class1
    Set igeg = New Class1
    igeg.kolom = 47
    igeg.rij = 559
    set MakeArray = igeg
    End Function
    
    
    sub test()
    Dim igeg As Class1
    set igeg = MakeArray(myvar)
    Msgbox igeg.kolom
    End sub
    

    If using just subs then:

    Public Sub MakeArray(ByRef OutputSheet As Variant, ByRef igeg As Class1)
     igeg.kolom = 47
     igeg.rij = 559
    End Sub
    
    
    Sub test()
     Dim myvar As Variant
     Dim igeg As Class1
    
      Set igeg = New Class1
    
      Call MakeArray(myvar, igeg)
      MsgBox igeg.kolom
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class named Page with a private property currently called _pageData which
I have made a front end for a program which test java (foo.class) binary
I have made a custom Attribute here named AAtribute, and for instance a class
I have made an JSR 168 portlet as follows: public class GetTest extends GenericPortlet
So i have made my own dict-based named-tuple class: class t(dict): def __getattr__(self, v):
I have made an aggregate class named Question . This contains references to Answer
I have made an class which conforms to the NSCoding protocol and does all
I have made a Java class where I have defined a constructor and some
I made a music class that will play a song. I have made onResume
I have made my own exception class which derives from runtime_error and is getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.