Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I force Excel to download, parse it and format the values in a table every time the .xlsx file is opened?

I tried importing the XML and it worked, but I don't know what to do from here.


share|improve this question
what's the problem you're actually trying to solve, maybe there is an easier solution (like a python snippet that outputs a csv file) – Tyler Dec 28 '09 at 19:37
up vote 0 down vote accepted

If you are using Data|Import External Query|New Web Query, there is a param, RefreshOnFileOpen, that you can just set to True.

Here is a snip that gets the data from the net, but doesn't format it (since you said you already got that working).

    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;", Destination:=Range("I12"))
        .Name = "evemon_1"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = True
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .