+ Reply to Thread
Results 1 to 4 of 4

Web query changing values to dates

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    Perth, aus
    MS-Off Ver
    Excel 2003
    Posts
    4

    Web query changing values to dates

    Hi everyone,

    Long time use, first time poster. Thanks to all who contribute to this forum it has allowed me to delve deep into excel enjoying every minute, but on this occasion i can't find anything to help me and have been racking my brain for weeks.

    It seems simple. I run web queries from a web page like this and don't want dates being recognised:

    https://www.racenet.com.au/form/hors...te=310117&rn=0

    (this will only work for 24 hours)

    When i import the data (through vba), it changes some stats like 35:10-4-5 to date formats. I've tried disabling date recognition but it simply changes it the good old 40000 date number.

    I've also tried converting all cell formats to text prior to running the query but that doesn't seem to work either.

    any help would be much appreciated.

    Cheers

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Web query changing values to dates

    I am not an expert in these things, but a quick search around suggests one possible fix, depending on how your VBA is doing the import. Try having the VBA add a non-printing character to the start/end of each 'not-a-date' field - maybe a tab character (ASCII 9). That might confuse Excel into treating the data as text (as you want it to).
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Registered User
    Join Date
    10-30-2012
    Location
    Perth, aus
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Web query changing values to dates

    Thanks for the suggestion Aardigspook. This is my script below, do you have any ideas on how to add in the character as suggested?

    With ActiveWorkbook.Worksheets("Performance").QueryTables.Add(Connection:=performance, Destination:=ActiveWorkbook.Worksheets("Performance").Range("A1"))
    .Name = shortperf
    .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 = """FormTable"""
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = True
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With

  4. #4
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Web query changing values to dates

    I'm sorry, but I've never done any web imports / queries, so I have no idea what would need to be added/changed.

    Hopefully someone else with more knowledge will be able to jump in to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. create select query to sum values in between dates
    By simonplus in forum Access Tables & Databases
    Replies: 3
    Last Post: 07-20-2016, 07:29 PM
  2. Excel 2010: Retain changing cell values - web query
    By John19 in forum Excel General
    Replies: 1
    Last Post: 12-20-2014, 12:43 PM
  3. Changing cell values on specific dates
    By dradford in forum Excel General
    Replies: 8
    Last Post: 05-09-2009, 09:13 AM
  4. Excel 2007 : Changing cell values on specific dates
    By dradford in forum Excel General
    Replies: 1
    Last Post: 05-09-2009, 07:19 AM
  5. Changing dates and Auto-Updating sql query
    By brianfitz in forum Excel General
    Replies: 0
    Last Post: 03-23-2009, 11:57 AM
  6. Custom Dates changing Values?
    By ringrim in forum Excel General
    Replies: 1
    Last Post: 08-20-2008, 06:07 PM
  7. Replies: 5
    Last Post: 05-09-2006, 01:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1