• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Web bağlantısında farklı tabloları farklı hedeflere atamak

Katılım
1 Mart 2012
Mesajlar
27
Excel Vers. ve Dili
2010 - EN
Merhaba,

Bir web bağlantısı oluşturduğumuzda kaydettiğim makrodan gördüğüm kadarıyla
Kod:
 .WebSelectionType = xlSpecifiedTables
kodunu ekledikten sonra
Kod:
.WebTables = "1"
gibi bir şey ile istediğimiz tabloyu ekleyebiliyoruz. Ancak "destination" sanırım ilgili bağlantıya atanan bir şey, tablolar için ayrı ayrı destination atama şansımız var mı yoksa her tablo için ayrı bağlantı mı yaratmak gerekiyor?

Örnek olarak aşağıya merkez bankasından enflasyon oranı çeken makroyu ekliyorum. Toplam iki tablo var. Benim yapmak istediğim, mümkünse, tek bağlantı içinde birinci ve ikinci tablo için ayrı hedef hücre belirtebilmek.

Şimdiden teşekkürler.

Kod:
Sub Macro3()
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://evds.tcmb.gov.tr/anaweb/enflasyonTR.html", Destination:=Range( _
        "$A$1"))
        .Name = "enflasyonTR"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
 
İki makro kullanmanız gerekiyor. Aşağıdaki kodu inceleyin...

Kod:
Sub Macro1()
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://evds.tcmb.gov.tr/anaweb/enflasyonTR.html", Destination:=Range( _
        [COLOR=Blue][B]"$A$1"[/B]))
        [B].Name = "makro1"[/B][/COLOR]
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        [COLOR=Blue][B].WebSelectionType = xlSpecifiedTables
        .WebTables = "1"[/B][/COLOR]
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
Kod:
Sub Macro2()
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://evds.tcmb.gov.tr/anaweb/enflasyonTR.html", Destination:=Range( _
       [COLOR=Blue] [B]"$M$1"[/B]))
       [B] .Name = "makro2"[/B][/COLOR]
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        [COLOR=Blue][B].WebSelectionType = xlSpecifiedTables
        .WebTables = "2"[/B][/COLOR]
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
 
Geri
Üst