473,466 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with class inheritance

25 New Member
Hello,

Please help with a following problem:

Class Module Myclass:

Expand|Select|Wrap|Line Numbers
  1. Private xl as excel.application
  2. Private wb As Excel.Workbook
  3.  
  4. Private Sub Class_Initialize()
  5.    Set xl = New Excel.Application
  6.    Set wb = xl.Workbooks.Add
  7. End Sub
  8.  
  9. Public Property Get CurrentWB() As Excel.Workbook
  10.    CurrentWB = wb
  11. End Property
Module Sub:

Expand|Select|Wrap|Line Numbers
  1. Dim test as myclass
  2.  
  3. Set test = new myclass
  4.  
  5. Msgbox Test.currentWB.name
  6.  
  7. Set test = nothing
Msgbox line fails….
What am I doing wrong? In general, I’m trying to inherit workbook properties and methods. Thanks for your help.
Apr 2 '08 #1
2 1685
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. Took a bit of testing to find the very simple answer: in your property get you have forgotten that it is an object property you are setting, so you need to use set:

set CurrentWB = wb

-Stewart
Apr 2 '08 #2
is49460
25 New Member
Thanks a lot, adding "set" did the trick...

Hi. Took a bit of testing to find the very simple answer: in your property get you have forgotten that it is an object property you are setting, so you need to use set:

set CurrentWB = wb

-Stewart
Apr 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: George Sakkis | last post by:
I'm looking for a design to a problem I came across, which goes like this (no, it's not homework): 1. There is a (single inheritance) hierarchy of domain classes, say A<-B<-..<-Z (arrows point...
4
by: Merlin | last post by:
Hi Imagine the following classes (A class diagram will help) BASE, A, B, C, D, E, F, G. A, B, C, D, G inherit from BASE. E, F inherit from D.
4
by: KInd | last post by:
Hello All, When is nested class more preferable that Inheritance ? I think with proper inheritance and friend class concept we can get the same flexibility as nested classes Any comments .. Best...
13
by: Walt Karas | last post by:
The following gives an error in the declaration of the member function x() of the class template Tpl, compiliing with a recent version of GCC under Solaris: class A { }; class B { }; ...
3
by: Morten Aune Lyrstad | last post by:
Hi again! I'm having problems with inheritance. I have a base interface class called IObject. Next I have two other interfaces classes, IControl and ICommandMaster, which derives from IObject. ...
3
by: Mark A. Gibbs | last post by:
Good day, i'm having a bit of trouble with a base class i'm working on. this is what it boils down to: template <typename T> class foo { protected: foo() { T* p = static_cast<T*>(this); }
0
by: Bita-kookoo | last post by:
I am having a problem with inheritance for my web solution. Here are the steps I took for a project within C#: -I first created a new class, descended from System.Web.UI.Page. For this...
0
by: Mariano | last post by:
Hi, I have posted a bug of the forms designer that overwrites always the Icon, thus preventing Icon inheritance when you derive from a form. I am trying to overcome this by adding an ImageList in...
8
by: shuisheng | last post by:
Dear All, I have a libaray which provides a base class of name Base and several derived classes of name Derived1, Derived2 and so on. I want to add a client data into those classes, such as ...
9
by: weird0 | last post by:
How does C++ and C# solve the Diamond problem? With the help of interfaces that is. Can anyone elaborate ....... Regards
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.