2016-10-26 3 views
0

コードをループ/実行する方法.txtファイルのリストに従って、リストが終了するまで??複数のリンクのマクロ

コードをループ/実行するには.txtファイルのリストに従って、リストが終了するまで??

Sub FundData() 

Dim TikerName As String 

    TikerName = 'check & execute the names in list one after one in .txt file until it ends up 

    With ActiveSheet.QueryTables.Add(Connection:= _ 
     "URL;http://example.com/index.php?name=" & TikerName, Destination:=Range(_ 
     "$A$1")) 
     '.CommandType = 0 
     .Name = "name=" & TikerName 
     .FieldNames = True 
     .RowNumbers = False 
     .FillAdjacentFormulas = False 
     .PreserveFormatting = True 
     .RefreshOnFileOpen = False 
     .BackgroundQuery = True 
     .RefreshStyle = xlInsertDeleteCells 
     .SavePassword = False 
     .SaveData = True 
     .AdjustColumnWidth = True 
     .RefreshPeriod = 0 
     .WebSelectionType = xlSpecifiedTables 
     .WebFormatting = xlWebFormattingNone 
     .WebTables = """company""" 
     .WebPreFormattedTextToColumns = True 
     .WebConsecutiveDelimitersAsOne = True 
     .WebSingleBlockTextImport = False 
     .WebDisableDateRecognition = False 
     .WebDisableRedirections = False 
     .Refresh BackgroundQuery:=False 
    End With 
    ActiveSheet.Name = TikerName 
    Sheets.Add After:=ActiveSheet 
    ThisWorkbook.Save 

End Sub 
+0

を "終わる??"ハァッ? –

+0

300以上の生の300文字以上の文字列があります。 TikerName.txtのようなtxtファイルの最後の(行)文字列 – user176705

答えて

0

このような構造の何かを作成します。

Sub FundData() 

    Dim TikerName As String 

    Open "C:\somepath\sometextfile.txt" For Input As #1 
    Do While Not EOF(1) 
     Line Input #1, TikerName 

     ' your main code goes here 

    Loop 
    Close #1 
    ThisWorkbook.Save 
End Sub 
+0

が応答しないことを示しています:( 同じサイトのExcelから同時に300+リンクアクセスが可能? – user176705

+0

@ user176705 - 私はあなたのコメントを理解しているかどうかわかりません。あなたの質問は「どのようにループ/コードを実行するのか」という意味ではないことを推測できます.txtファイルのリストに従って、 Excelが300のクエリを同時に実行できるように十分なリソースを得るにはどうすればよいのですか?もしそうなら、質問したものとは大きく異なる新しい質問を作成することをお勧めします。 – YowE3K

+0

ありがとうあなたの素敵な理解のために私の友人。私はまもなく新しい質問をします。 – user176705

関連する問題