<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FAccess%2FQueryTable</id>
		<title>VBA/Excel/Access/Word/Access/QueryTable - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FAccess%2FQueryTable"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Access/QueryTable&amp;action=history"/>
		<updated>2026-04-06T20:34:57Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Access/QueryTable&amp;diff=1276&amp;oldid=prev</id>
		<title> в 16:33, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Access/QueryTable&amp;diff=1276&amp;oldid=prev"/>
				<updated>2010-05-26T16:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:33, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Access/QueryTable&amp;diff=1277&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Access/QueryTable&amp;diff=1277&amp;oldid=prev"/>
				<updated>2010-05-26T12:46:44Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Building a New Web Query with VBA==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CreateNewQuery()&lt;br /&gt;
    Dim WSD As Worksheet&lt;br /&gt;
    Dim WSW As Worksheet&lt;br /&gt;
    Dim myQueryTable As QueryTable&lt;br /&gt;
    Dim FinalRow As Long&lt;br /&gt;
    Dim i As Integer&lt;br /&gt;
    Dim ConnectString As String&lt;br /&gt;
    Dim FinalResultRow As Long&lt;br /&gt;
    Dim RowCount As Long&lt;br /&gt;
    Set WSD = Worksheets(&amp;quot;Portfolio&amp;quot;)&lt;br /&gt;
    Set WSW = Worksheets(&amp;quot;Workspace&amp;quot;)&lt;br /&gt;
    FinalRow = WSD.Cells(Rows.Count, 1).End(xlUp).Row&lt;br /&gt;
    For i = 2 To FinalRow&lt;br /&gt;
        Select Case i&lt;br /&gt;
            Case 2&lt;br /&gt;
                ConnectString = &amp;quot;URL;http://finance.Yahoo.ru/q/cq?d=v1&amp;amp;s=&amp;quot; &amp;amp; WSD.Cells(i, 1).Value&lt;br /&gt;
            Case Else&lt;br /&gt;
                ConnectString = ConnectString &amp;amp; &amp;quot;%2c+&amp;quot; &amp;amp; WSD.Cells(i, 1).Value&lt;br /&gt;
        End Select&lt;br /&gt;
    Next i&lt;br /&gt;
    For Each myQueryTable In WSW.QueryTables&lt;br /&gt;
        myQueryTable.Delete&lt;br /&gt;
    Next myQueryTable&lt;br /&gt;
    Set myQueryTable = WSW.QueryTables.Add(Connection:=ConnectString, _&lt;br /&gt;
        Destination:=WSW.Range(&amp;quot;A1&amp;quot;))&lt;br /&gt;
    With myQueryTable&lt;br /&gt;
        .Name = &amp;quot;portfolio&amp;quot;&lt;br /&gt;
        .FieldNames = True&lt;br /&gt;
        .RowNumbers = False&lt;br /&gt;
        .FillAdjacentFormulas = False&lt;br /&gt;
        .PreserveFormatting = True&lt;br /&gt;
        .RefreshOnFileOpen = False&lt;br /&gt;
        .BackgroundQuery = False&lt;br /&gt;
        .RefreshStyle = xlInsertDeleteCells&lt;br /&gt;
        .SavePassword = False&lt;br /&gt;
        .SaveData = True&lt;br /&gt;
        .AdjustColumnWidth = True&lt;br /&gt;
        .RefreshPeriod = 0&lt;br /&gt;
        .WebSelectionType = xlSpecifiedTables&lt;br /&gt;
        .WebFormatting = xlWebFormattingNone&lt;br /&gt;
        .WebTables = &amp;quot;11&amp;quot;&lt;br /&gt;
        .WebPreFormattedTextToColumns = True&lt;br /&gt;
        .WebConsecutiveDelimitersAsOne = True&lt;br /&gt;
        .WebSingleBlockTextImport = False&lt;br /&gt;
        .WebDisableDateRecognition = False&lt;br /&gt;
        .WebDisableRedirections = False&lt;br /&gt;
    End With&lt;br /&gt;
    myQueryTable.Refresh BackgroundQuery:=False&lt;br /&gt;
    FinalResultRow = WSW.Cells(Rows,Count, 1).End(xlUp).Row&lt;br /&gt;
    WSW.Cells(1, 1).Resize(FinalResultRow, 7).Name = &amp;quot;WebInfo&amp;quot;&lt;br /&gt;
    RowCount = FinalRow - 1&lt;br /&gt;
    WSD.Cells(2, 2).Resize(RowCount, 1).FormulaR1C1 = &amp;quot;=VLOOKUP(RC1,WebInfo,3,False)&amp;quot;&lt;br /&gt;
    WSD.Cells(2, 3).Resize(RowCount, 1).FormulaR1C1 = &amp;quot;=VLOOKUP(RC1,WebInfo,4,False)&amp;quot;&lt;br /&gt;
    WSD.Cells(2, 4).Resize(RowCount, 1).FormulaR1C1 = &amp;quot;=VLOOKUP(RC1,WebInfo,5,False)&amp;quot;&lt;br /&gt;
    WSD.Cells(2, 5).Resize(RowCount, 1).FormulaR1C1 = &amp;quot;=VLOOKUP(RC1,WebInfo,6,False)&amp;quot;&lt;br /&gt;
    WSD.Cells(2, 6).Resize(RowCount, 1).FormulaR1C1 = &amp;quot;=VLOOKUP(RC1,WebInfo,2,False)&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==creates a QueryTable object on the active worksheet and sets its data source to a single table from a Web page at the designated location:==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Public Sub ImportWeb()&lt;br /&gt;
   Dim qt As QueryTable&lt;br /&gt;
   Set qt = ActiveSheet.QueryTables.Add(Connection:=&amp;quot; URL;http://finance.yahoo.ru/q?s=^DJI&amp;amp;d=v1&amp;quot;, _&lt;br /&gt;
        Destination:=Range(&amp;quot;A1&amp;quot;))&lt;br /&gt;
    With qt&lt;br /&gt;
        .name = &amp;quot;DJIQuery&amp;quot;&lt;br /&gt;
        .WebSelectionType = xlSpecifiedTables&lt;br /&gt;
        .WebTables = &amp;quot;16&amp;quot;    &amp;quot; DJI table&lt;br /&gt;
        .WebFormatting = xlWebFormattingNone&lt;br /&gt;
        .EnableRefresh = True&lt;br /&gt;
        .RefreshPeriod = 5   &amp;quot;Unit in minutes&lt;br /&gt;
        .Refresh     &amp;quot;Execute query&lt;br /&gt;
    End With&lt;br /&gt;
    Set qt = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using VBA to Update an Existing Web Query==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub RefreshAllWebQueries()&lt;br /&gt;
    Dim QT As QueryTable&lt;br /&gt;
    For Each QT In ActiveSheet.QueryTables&lt;br /&gt;
        Application.StatusBar = &amp;quot;Refreshing &amp;quot; &amp;amp; QT.Connection&lt;br /&gt;
        QT.Refresh&lt;br /&gt;
    Next QT&lt;br /&gt;
    Application.StatusBar = False&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>