这是我第一次使用类模块,当我正在工作时,错误91在我设置属性时发生。我搜索了它,并了解到我应该使用set。但是,即使我使用set,它也会抛出“Object Variable Not Set”。最后一点是,我不是在谈论注释行。
我的模块:
Option Explicit
Public Static Sub VeriGetir()
Sheets("Veri Sayfası").Activate
Dim römorklar() As Römork
Dim index As Integer
index = -1
Dim i
For i = 2 To 100
If Not Cells(1, i) = "" And Not Cells(12, i) = "" Then
Dim vRömork As Römork
Set vRömork = New Römork
vRömork.ÜrünKodu = Cells(1, i)
Dim öz As MetinÖzellik
Set öz = New MetinÖzellik
öz.Ayarla "asd", 12
Set vRömork.DingilSayısı = öz 'Error here
'Set vRömork.Ton = Cells(3, i)
'Set vRömork.En = Cells(4, i)
'Set vRömork.Boy = Cells(5, i)
'Set vRömork.KüçükYük = Cells(6, i)
'Set vRömork.İlave1 = Cells(7, i)
'Set vRömork.İlave2 = Cells(8, i)
'Set vRömork.ÖnAks = Cells(9, i)
'Set vRömork.ArkaAks = Cells(10, i)
'Set vRömork.Jant = Cells(11, i)
'Set vRömork.Lastik = Cells(12, i)
'index = index + 1
'ReDim römorklar(index)
'römorklar(index) = vRömork
End If
Next i
End Sub
Public Function MetinOluştur(isim As String, fiyat As Double) As MetinÖzellik
Dim özellik As MetinÖzellik
Set özellik = New MetinÖzellik
özellik.Ayarla isim, fiyat
Set MetinOluştur = özellik
End Function
Public Static Function SayıOluştur(değer As Double, fiyat As Double) As SayıÖzellik
Dim sayı_özellik As SayıÖzellik
Set sayı_özellik = New SayıÖzellik
sayı_özellik.Ayarla değer, fiyat
Set SayıOluştur = sayı_özellik
End Function
Römork课程模块:
Option Explicit
Private pÜrünKodu As String
Private pDingilSayısı As MetinÖzellik
Private pTon As MetinÖzellik
Private pEn As SayıÖzellik
Private pBoy As SayıÖzellik
Private pKüçükYük As SayıÖzellik
Private pİlave1 As SayıÖzellik
Private pİlave2 As SayıÖzellik
Private pÖnAks As MetinÖzellik
Private pArkaAks As MetinÖzellik
Private pJant As MetinÖzellik
Private pLastik As MetinÖzellik
Public Property Get ÜrünKodu() As String
ÜrünKodu = pÜrünKodu
End Property
Public Property Let ÜrünKodu(Value As String)
pÜrünKodu = Value
End Property
Public Property Get DingilSayısı() As MetinÖzellik
DingilSayısı = pDingilSayısı
End Property
Public Property Let DingilSayısı(Value As MetinÖzellik)
pDingilSayısı = Value
End Property
Public Property Get Ton() As MetinÖzellik
Ton = pTon
End Property
Public Property Let Ton(Value As MetinÖzellik)
pTon = Value
End Property
Public Property Get ÖnAks() As MetinÖzellik
ÖnAks = pÖnAks
End Property
Public Property Let ÖnAks(Value As MetinÖzellik)
pÖnAks = Value
End Property
Public Property Get ArkaAks() As MetinÖzellik
ArkaAks = pArkaAks
End Property
Public Property Let ArkaAks(Value As MetinÖzellik)
pArkaAks = Value
End Property
Public Property Get Jant() As MetinÖzellik
Jant = pJant
End Property
Public Property Let Jant(Value As MetinÖzellik)
pJant = Value
End Property
Public Property Get Lastik() As MetinÖzellik
Lastik = pLastik
End Property
Public Property Let Lastik(Value As MetinÖzellik)
pLastik = Value
End Property
' En Boy K.Yük İlave1 İlave2
Public Property Get En() As SayıÖzellik
En = pEn
End Property
Public Property Let En(Value As SayıÖzellik)
pEn = Value
End Property
Public Property Get Boy() As SayıÖzellik
Boy = pBoy
End Property
Public Property Let Boy(Value As SayıÖzellik)
pBoy = Value
End Property
Public Property Get KüçükYük() As SayıÖzellik
KüçükYük = pKüçükYük
End Property
Public Property Let KüçükYük(Value As SayıÖzellik)
pKüçükYük = Value
End Property
Public Property Get İlave1() As SayıÖzellik
İlave = pİlave1
End Property
Public Property Let İlave1(Value As SayıÖzellik)
pİlave1 = Value
End Property
Public Property Get İlave2() As SayıÖzellik
İlave2 = pİlave2
End Property
Public Property Let İlave2(Value As SayıÖzellik)
İlave2 = Value
End Property
MetinÖzellik课程模块:
Option Explicit
Private pİsim As String
Private pFiyat As Double
Public Property Get İsim() As String
İsim = pİsim
End Property
Public Property Let İsim(Value As String)
pİsim = Value
End Property
Public Property Get fiyat() As Double
fiyat = pFiyat
End Property
Public Property Let fiyat(Value As Double)
pFiyat = Value
End Property
Public Sub Ayarla(pİsim As String, pFiyat As Double)
Me.İsim = pİsim
Me.fiyat = pFiyat
End Sub
SayıÖzellik课程模块:
Option Explicit
Private pDeğer As Double
Private pFiyat As Double
Public Property Get değer() As String
değer = pDeğer
End Property
Public Property Let değer(Value As String)
pDeğer = Value
End Property
Private pFiyat As Double
Public Property Get fiyat() As Double
fiyat = pFiyat
End Property
Public Property Let fiyat(Value As Double)
pFiyat = Value
End Property
Public Sub Ayarla(pDeğer As Double, pFiyat As Double)
Me.değer = pDeğer
Me.fiyat = pFiyat
End Sub
Public Static Function Oluştur(değer As Double, fiyat As Double) As SayıÖzellik
Dim sayı_özellik As SayıÖzellik
Set sayı_özellik = New SayıÖzellik
sayı_özellik.Ayarla değer, fiyat
Set Oluştur = sayı_özellik
End Function