0

I'm calling a function to add dates to a complicated URL String to make it variable. The debug in the function PutTogetherURL() prints the correct URL however the debug for URL(4) does not. I know i'm missing something stupid easy I just can't figure out what. Any advice appreciated.

Sub PullStuff()

Dim response As String

Dim URL(1 To 13) As Variant, BoB
Dim PullDate As Date

PullDate = Sheets("EOD").Range("M5")

BoB = 11

URL(1) = "google.com"
URL(2) = "Yahoo.com"
URL(3) = "Amazon.com"

URL(4) = PutTogetherURL(Format(PullDate, "yyyy-mm-dd"))

End Sub


Function PutTogetherURL(StartDate As String) As String

Dim URL As String

URL = "Yahoo" & StartDate & ".com"

Debug.Print URL

Exit Function

End Function
craigG
  • 1
  • 1
  • 4
    You never assign anything to `PutTogetherURL`, i.e. `PutTogetherURL = URL`, so `PutTogetherURL` returns a blank string. – BigBen Sep 24 '19 at 20:37

1 Answers1

4

PutTogetherURL is returning a blank string.

Function PutTogetherURL(StartDate As String) As String

    Dim URL As String
    URL = "Yahoo" & StartDate & ".com"

    Debug.Print URL

    PutTogetherURL = URL ' return concatenated URL

End Function
BigBen
  • 46,229
  • 7
  • 24
  • 40