iş yerimde (office 2007 yüklü) çalıştığım dosyam, evdeki bilgisayarımda (office 2010 yüklü) çalışmıyor. dosya açılırken önce "could not load an object because an object is not available on this machine" hatası alıyorum. ardından debug dediğimde userform10.show satırında hata alıyorum, userform10 ise bir listbox, arama butonu, combobox ve commandbuttonların olduğu bir userform.
sorun neden kaynaklanıyor anlamış değilim. userformdaki kod;
arama butonundaki kod:
sorun neden kaynaklanıyor anlamış değilim. userformdaki kod;
Kod:
Private Sub UserForm_Initialize()
Dim X As Byte
Dim Buton_Adı() As Variant
Dim Sistem_Genişlik As Long, Sistem_Yükseklik As Long
Dim Form_Genişlik As Long, Form_Yükseklik As Long
Dim Genişlik_Oranı As Double, Yükseklik_Oranı As Double
Dim Nesne As Control
Sistem_Genişlik = Application.Width - 8
Sistem_Yükseklik = Application.Height - 8
Form_Genişlik = UserForm10.Width
Form_Yükseklik = UserForm10.Height
Genişlik_Oranı = Sistem_Genişlik / Form_Genişlik
Yükseklik_Oranı = Sistem_Yükseklik / Form_Yükseklik
UserForm10.Width = Sistem_Genişlik
UserForm10.Height = Sistem_Yükseklik
For Each Nesne In UserForm10.Controls
Nesne.Top = Nesne.Top * Yükseklik_Oranı
Nesne.Left = Nesne.Left * Genişlik_Oranı
Nesne.Width = Nesne.Width * Genişlik_Oranı
Nesne.Height = Nesne.Height * Yükseklik_Oranı
On Error Resume Next
Nesne.Font.Size = Nesne.Font.Size * Yükseklik_Oranı - 1
On Error GoTo 0
Next
Dim i As Long, syf As Integer, deg As Variant
Dim d, a, t
Set d = CreateObject("Scripting.Dictionary")
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
ListView1.View = lvwReport
With ListView1.ColumnHeaders
.Add , , "Sayfa", 70
.Add , , "Hücre", 40
.Add , , "Aranan", 65
End With
For syf = 1 To Sheets.Count
For i = 2 To Sheets(syf).Cells(Rows.Count, "A").End(3).Row
deg = Sheets(syf).Cells(i, "a")
If Not d.exists(deg) Then
d.Add deg, deg
ComboBox1.AddItem deg
End If
Next i
Next syf
ListView1.FullRowSelect = True
ListView1.Gridlines = True
End Sub
arama butonundaki kod:
Kod:
Private Sub CommandButton1_Click()
Dim C As Range, ilkadres As Variant, i As Integer, j As Long
ListView1.ListItems.Clear
For i = 1 To Sheets.Count
With Sheets(i).Range("A:A")
Set C = .Find("*" & ComboBox1.Value, , LookIn:=xlValues)
If Not C Is Nothing Then
ilkadres = C.Address
Do
j = j + 1
ListView1.ListItems.Add , , Sheets(i).Name
ListView1.ListItems(j).SubItems(1) = .Range("A" & C.Row).Address
ListView1.ListItems(j).SubItems(2) = .Range("A" & C.Row)
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> ilkadres
End If
End With
Next i
End Sub