Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

10 Şubat 2007 Cumartesi

VBProject Referans Dosya (olb-tlb-dll-exe-ocx) ve Guid Yönetimi





UserForm1

A) Normal Reference Add

1 Visual Basıc For Applications;
2 Microsoft Excel 11.0 Object Library
3 Microsoft Forms 2.0 Object Library
4 Microsoft Windows Common Controls 6.0 (SP6)
5 OLE Automation
6 Microsoft Office 11.0 Object Library
7 Wicrosoft Office WebComponents 11.0
B) Tools Add on UserForm1\
1. Frame1
2. Frame1\Label1 ve Frame\Label2
3. Frame\Image1
4. ListBox1
5. CommandButton1
6. ComboBox1
7. TexBox1, TexBox2, TexBox3

Option Explicit
Dim i As Single, No As Single
Dim Aranan As Variant, Sorgu, Major As Double, Minor As Double
Private EkranBezeme As New Class1

Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "[PBİD®] VBProject Referans Dosya (olb-tlb-dll-exe-ocx) ve Guid Yönetimi"
Application.Visible = False
Application.VBE.MainWindow.Visible = False
Call EkranDüzenle
Call MevcutReferansListesi
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
On Error Resume Next
Application.Visible = True
End
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
If (TextBox1.Text <> "") Then Call HedeflenenReferansTaraması
End Sub
Sub EkranDüzenle()
On Error Resume Next
With Me
.Width = 510
.Height = 294.75
.BackColor = &H80000016
With Frame1
.Top = -2
.Left = -2
.Height = 36
.Width = Me.Width + 12
.Picture = LoadPicture("C:\Documents and Settings\PC\Desktop\BLOGSPOT\Örnekİkonlar\VistaWP01.bmp")
.PictureAlignment = fmPictureAlignmentTopLeft
.PictureSizeMode = fmPictureSizeModeClip
.PictureTiling = False
With Label1
.Caption = " " & "Mustafa ULUSARAÇ"
.BackStyle = fmBackStyleTransparent
.BorderStyle = fmBorderStyleNone
.SpecialEffect = fmSpecialEffectFlat
.Left = 30
.Top = 6
.Height = 12
.Width = 198
.Font.Bold = True
.ForeColor = &HFF0000
End With
With Label2
.Caption = " " & "01ulusarac@superonline.com"
.BackStyle = fmBackStyleTransparent
.BorderStyle = fmBorderStyleNone
.SpecialEffect = fmSpecialEffectFlat
.Left = 30
.Top = 18
.Height = 12
.Width = 198
.Font.Bold = True
.ForeColor = &HFF0000
End With
With Image1
.BackStyle = fmBackStyleTransparent
.BorderColor = &HFF0000
.BorderStyle = fmBorderStyleSingle
.Top = 6
.Left = 6
.Height = 24
.Width = 24
.Picture = LoadPicture("C:\Documents and Settings\PC\Desktop\BLOGSPOT\Örnekİkonlar\PBİD.ico")
End With
End With
With ListBox1
.Top = 42
.Left = 6
.Width = 492
.Height = 198.05
.BackColor = &H80000001
.SpecialEffect = fmSpecialEffectEtched
.ColumnCount = 2
.ColumnWidths = "96;384"
.ForeColor = &HFF00&
End With
With CommandButton1
.Left = 6
.Top = 246
.Height = 18
.Width = 84
.Caption = "Reference Ekle"
End With
With ComboBox1
.Left = 96
.Top = 246
.Height = 18
.Width = 66
.AddItem "FormFile"
.AddItem "FormGuid"
.ListIndex = 0
.SpecialEffect = fmSpecialEffectEtched
End With
With TextBox1
.Left = 162
.Top = 246
.Height = 18
.Width = 300
.SpecialEffect = fmSpecialEffectEtched
End With
With TextBox2
.Left = 462
.Top = 246
.Height = 18
.Width = 18
.SpecialEffect = fmSpecialEffectEtched
.ControlTipText = "FormGuid Major"
End With
With TextBox3
.Left = 480
.Top = 246
.Height = 18
.Width = 18
.SpecialEffect = fmSpecialEffectEtched
.ControlTipText = "FormGuid Minor"

End With
End With
End Sub
Sub MevcutReferansListesi()
On Error Resume Next
ListBox1.Clear
For i = 1 To ThisWorkbook.VBProject.References.Count
No = ListBox1.ListCount
ListBox1.AddItem "References.Item": ListBox1.List(No, 1) = i: ListBox1.AddItem
ListBox1.List(No + 1, 0) = "References.Name": ListBox1.List(No + 1, 1) = ThisWorkbook.VBProject.References.item(i).Name: ListBox1.AddItem ""
ListBox1.List(No + 2, 0) = "References.Description": ListBox1.List(No + 2, 1) = ThisWorkbook.VBProject.References.item(i).Description: ListBox1.AddItem ""
ListBox1.List(No + 3, 0) = "References.FullPath": ListBox1.List(No + 3, 1) = ThisWorkbook.VBProject.References.item(i).FullPath: ListBox1.AddItem ""
ListBox1.List(No + 4, 0) = "References.BuiltIn": ListBox1.List(No + 4, 1) = ThisWorkbook.VBProject.References.item(i).BuiltIn: ListBox1.AddItem ""
ListBox1.List(No + 5, 0) = "References.GUID": ListBox1.List(No + 5, 1) = ThisWorkbook.VBProject.References.item(i).GUID: ListBox1.AddItem ""
ListBox1.List(No + 6, 0) = "References.IsBroken": ListBox1.List(No + 6, 1) = ThisWorkbook.VBProject.References.item(i).IsBroken: ListBox1.AddItem ""
ListBox1.List(No + 7, 0) = "References.Major": ListBox1.List(No + 7, 1) = ThisWorkbook.VBProject.References.item(i).Major: ListBox1.AddItem ""
ListBox1.List(No + 8, 0) = "References.Minor": ListBox1.List(No + 8, 1) = ThisWorkbook.VBProject.References.item(i).Minor: ListBox1.AddItem ""
ListBox1.List(No + 9, 0) = "References.Type": ListBox1.List(No + 9, 1) = ThisWorkbook.VBProject.References.item(i).Type: ListBox1.AddItem ""
ListBox1.List(No + 10, 0) = "References.VBE.Version": ListBox1.List(No + 10, 1) = ThisWorkbook.VBProject.References.item(i).VBE.Version: ListBox1.AddItem ""
Next
End Sub
Sub HedeflenenReferansTaraması()
On Error GoTo Hata
For i = 1 To ThisWorkbook.VBProject.References.Count
Aranan = ThisWorkbook.VBProject.References.item(i).Name
If Aranan = TextBox1.Text Then
MsgBox "Aranan Referans Bu Projede Mevcuttur..."
Exit Sub
End If
Next i
Sorgu = MsgBox("Referansın bu projeye eklenmesini istiyor musunuz?" & vbCrLf & vbCrLf & "Mustafa ULUSARAÇ 01ulusarac@superonline.com", vbYesNo, "[PBİD®] VBA Project Referans Tercihi")
If ComboBox1.Value = "FormFile" Then
If Sorgu = vbYes Then ThisWorkbook.VBProject.References.AddFromFile TextBox1.Value 'Örnek: Outlook
Else
Major = TextBox2.Value: Minor = TextBox3.Value
If Sorgu = vbYes Then ThisWorkbook.VBProject.References.AddFromGuid TextBox1.Value, Major, Minor
'Örnek: OutLook; "{00062FFF-0000-0000-C000-000000000046}",9,2
End If
MsgBox "Referansın bu projeye eklendi." & vbCrLf & vbCrLf & "Mustafa ULUSARAÇ 01ulusarac@superonline.com", vbExclamation, "[PBİD®] VBA Project Referans Tercihi"
Call MevcutReferansListesi
Exit Sub
Hata:
MsgBox "Referans bulunamadı." & vbCrLf & vbCrLf & "Mustafa ULUSARAÇ 01ulusarac@superonline.com", vbExclamation, "[PBİD®] VBA Project Referans Tercihi"
End Sub

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul