Creating a Custom OBJECT

seboseszuk

New Member
Joined
Jun 4, 2011
Messages
18
Greetings,

I use Mr.Excel's book:Excel 2007 page 481 and 482.
File name:clsEmployee, module: Class

Public EmpName as string
Public EmpId as string
Public EmpRate as double
Public EmpWeeklyHours as double
Public Function EmpWeeklyPay()dluble
EmpWeeklyPay= EmpRate* EmpHours
End Function

File name: clsEmployee, module1
Option Explicit
Dim Employee as clsEmployee
with Employee
.EmpName=" Tracy Syrstad"
.EmpId ="1651"
.EmpRate=25
.EmpHours=40
End with
End Sub

These modules create an error message.
Help will be appreciated.

Gabor
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Gabor

Is this a continuation of this thread?

http://www.mrexcel.com/forum/showthread.php?t=554907

What do you mean here:

File name:clsEmployee, module: Class

File name: clsEmployee, module1

Have you used the name 'clsEmployee' for more than one thing?

I'm pretty sure you shouldn't do that, and I'm definite it's a bad idea to do so even if your allowed to.
 
Upvote 0
You are missing:
Code:
Set Employee = New clsEmployee
after:
Code:
Dim Employee as clsEmployee
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top