Click here to Skip to main content
15,907,905 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Wanting to use a For Next variable in “xxxx.Rows.Count” Pin
Maciej Los23-May-17 20:55
mveMaciej Los23-May-17 20:55 
QuestionRe: Wanting to use a For Next variable in “xxxx.Rows.Count” Pin
ZurdoDev24-May-17 4:02
professionalZurdoDev24-May-17 4:02 
AnswerRe: Wanting to use a For Next variable in “xxxx.Rows.Count” Pin
Member 834559924-May-17 6:33
Member 834559924-May-17 6:33 
QuestionCreating Access 2007+ files Pin
JR21222-May-17 18:47
JR21222-May-17 18:47 
AnswerRe: Creating Access 2007+ files PinPopular
Richard MacCutchan22-May-17 21:54
mveRichard MacCutchan22-May-17 21:54 
GeneralRe: Creating Access 2007+ files Pin
JR21224-May-17 1:38
JR21224-May-17 1:38 
AnswerRe: Creating Access 2007+ files Pin
Maciej Los23-May-17 20:25
mveMaciej Los23-May-17 20:25 
QuestionYahoo Finance API Throwing 504 Status? Pin
Member 1321215119-May-17 22:57
Member 1321215119-May-17 22:57 
Hi - I use the Yahoo Finance API, to get Stock Quotes. The following code is showing a Status of 504. Does this mean that the service is discontinued or that the server is temporarily down? Can anybody suggest an alternative - where the function takes input of Ticker and Date, and gives output of Closing Price? Please ignore the error checks I am doing in the function below, since this is part of a larger macro and excuse the amateurish programming skills!

Public Function StockQuote(strTicker As String, Optional dtDate As Variant)
 ' Date is optional - if omitted, use today. If value is not a date, throw error.
 
 If IsMissing(dtDate) Then
      dtDate = Date
 Else
     If Not (IsDate(dtDate)) Then
         StockQuote = CVErr(xlErrNum)
     End If
 End If

 Dim dtPrevDate As Date
 Dim strURL As String
 Dim strCSV As String
 Dim strRows() As String
 Dim strColumns() As String
 Dim dbClose As Double

 dtPrevDate = dtDate - 7 'need a previous date cos of API Service

' Compile the request URL with start date and end date
 strURL = "http://ichart.finance.yahoo.com/table.csv?s=" & strTicker & _
 "&a=" & Month(dtPrevDate) - 1 & _
 "&b=" & Day(dtPrevDate) & _
 "&c=" & Year(dtPrevDate) & _
 "&d=" & Month(dtDate) - 1 & _
 "&e=" & Day(dtDate) & _
 "&f=" & Year(dtDate) & _
 "&g=d&ignore=.csv"

Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
 http.Open "GET", strURL, False
 http.Send
 strCSV = http.responseText
 
' The most recent information is in row 2, just below the table headings.
' The price close is the 5th entry

 If http.readystate = 4 Then
    If http.Status = 200 Then
       strRows() = Split(strCSV, Chr(10)) ' split the CSV into rows
       strColumns = Split(strRows(1), ",") ' split the relevant row into columns. 1 means 2nd row, starting at index 0
       dbClose = strColumns(4) ' 4 means: 5th position, starting at index 0
    Else
       dbClose = 0
       GlobalErrorCount = GlobalErrorCount + 1
    End If
 Else
    dbClose = 0
    GlobalErrorCount = GlobalErrorCount + 1
 End If
 

StockQuote = dbClose

Set http = Nothing

End Function

AnswerRe: Yahoo Finance API Throwing 504 Status? Pin
Afzaal Ahmad Zeeshan19-May-17 23:56
professionalAfzaal Ahmad Zeeshan19-May-17 23:56 
QuestionOutlook signature code suddenly causing "remote procedure call failed" message Pin
Member 1320910118-May-17 7:18
Member 1320910118-May-17 7:18 
AnswerRe: Outlook signature code suddenly causing "remote procedure call failed" message Pin
Richard MacCutchan18-May-17 21:43
mveRichard MacCutchan18-May-17 21:43 
GeneralRe: Outlook signature code suddenly causing "remote procedure call failed" message Pin
Member 134178014-Dec-19 3:07
Member 134178014-Dec-19 3:07 
GeneralRe: Outlook signature code suddenly causing "remote procedure call failed" message Pin
Richard MacCutchan4-Dec-19 3:28
mveRichard MacCutchan4-Dec-19 3:28 
GeneralRe: Outlook signature code suddenly causing "remote procedure call failed" message Pin
Member 134178014-Dec-19 3:32
Member 134178014-Dec-19 3:32 
GeneralRe: Outlook signature code suddenly causing "remote procedure call failed" message Pin
Richard MacCutchan4-Dec-19 3:45
mveRichard MacCutchan4-Dec-19 3:45 
QuestionRetrieving value from an XML file Pin
Ben Senior17-May-17 8:32
Ben Senior17-May-17 8:32 
GeneralRe: Retrieving value from an XML file Pin
PIEBALDconsult17-May-17 14:11
mvePIEBALDconsult17-May-17 14:11 
GeneralRe: Retrieving value from an XML file Pin
Ben Senior17-May-17 22:33
Ben Senior17-May-17 22:33 
GeneralRe: Retrieving value from an XML file Pin
Richard MacCutchan17-May-17 23:08
mveRichard MacCutchan17-May-17 23:08 
GeneralRe: Retrieving value from an XML file Pin
Ben Senior19-May-17 7:40
Ben Senior19-May-17 7:40 
GeneralRe: Retrieving value from an XML file Pin
Richard MacCutchan19-May-17 21:13
mveRichard MacCutchan19-May-17 21:13 
AnswerRe: Retrieving value from an XML file Pin
David Mujica19-May-17 7:02
David Mujica19-May-17 7:02 
GeneralRe: Retrieving value from an XML file Pin
Ben Senior19-May-17 7:26
Ben Senior19-May-17 7:26 
GeneralRe: Retrieving value from an XML file Pin
David Mujica19-May-17 8:28
David Mujica19-May-17 8:28 
AnswerRe: Retrieving value from an XML file Pin
Ben Senior20-May-17 4:28
Ben Senior20-May-17 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.