?
Solved

question

Posted on 1998-12-22
9
Medium Priority
?
287 Views
Last Modified: 2010-05-03
Suppose you have reference to muclass
could folloving code run and if then what  
Msgbox will display
Sub MySub(argObject as MyClass)

On Error Resume Next
Dim MyObject as New MyClass
Err.Clear
Set MyObject = argObject
argObject.Value = 100
Set argObject = Nothing
MsgBox MyObject.Value & "/" & Err.Description
End Sub

0
Comment
Question by:mativare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452088
No, code is not correct.
- err.clear will clear the description
- new is useless
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452089
Your code is the same as this
Sub MySub(argObject as MyClass)
  argObject.Value = 100
End Sub

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452090
You probably meant this

Sub MySub(argObject as MyClass)
  On Error goto leave
  Set argObject  = new MyClass
  argObject.Value = 100
  exit sub
leave:
  MsgBox Err.Description
End Sub

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:mativare
ID: 1452091
No
Try to use only my code
I got it from so-called VB WWW tests.
Try to give a answer what messagebox will display
you are probably right that code is not right
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452092
It will display the old value of the argobject \

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452093
100\
0
 
LVL 1

Author Comment

by:mativare
ID: 1452094
Are you sure
Notice
Set MyObject = argObject
argObject.Value = 100
so argobject gets value after
are you sure
Set MyObject = argObject sets value of Myobject too automatically
it is confusing to me
can answer be     0\      ????

0
 
LVL 1

Accepted Solution

by:
mathies earned 200 total points
ID: 1452095
100/
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452096
Tell me what you want to know
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question