View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
slimswol slimswol is offline
external usenet poster
 
Posts: 1
Default web query in VBA (format dates in url)


Hello,
I have looked everywhere and I cannot seem to get an example to fin
out what I am doing wrong. I need to create a web query within a macr
for Excel. The web query will return results from a form which has
fields:
Field 1: Status
Field 2: BeginDate
Field 3: EndDate

I will be entering the status parameter manually into the url, but th
dates need to be in the format (yyyy-mm-dd) and both fields need t
have today's date. It sounds simple, but I can't seem to get it t
work. Here is some code which is very simular to what I have:


Sub URL_Query()

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://mywebsite.com/abc?name=volfor...n&BeginDat e=
& Format(Now(), "yyyy-mm-dd") & EndDate=" & Format(Now()
"yyyy-mm-dd")", _
Destination:=Range("a1"))

.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub


Any help on this would be greatly appreciated!
Thank

--
slimswo
-----------------------------------------------------------------------
slimswol's Profile: http://www.excelforum.com/member.php...fo&userid=3201
View this thread: http://www.excelforum.com/showthread.php?threadid=51756