I created an automation of online survey creation that will create survey based on available data on a certain cell but once the loop ends an error points to 'If ThisWorkbook.Sheets("Sheet1").Range("B" & count) <> "" Then' as this was not defined as global.
Below is my code;
Sub create_survey()
Dim IE As Object
Dim Status, Stat, ttle, link As String
Dim count, repeat As Integer
Set IE = CreateObject("InternetExplorer.Application")
Stat = "Complete"
ttle = "***** Application Support User Survey "
count = 6
Status = Range("C" & count).Value
Do Until Status <> ""
If Status = "" Then
If ThisWorkbook.Sheets("Sheet1").Range("B" & count) <> "" Then
IE.Navigate "http://..."
link = "http://.../" & ttle & ThisWorkbook.Sheets("Sheet1").Range("B" & count) & "/....aspx"
IE.Visible = False
While IE.Busy
DoEvents
Wend
IE.Document.all("onetidListTitle").Value = ttle & ThisWorkbook.Sheets("Sheet1").Range("B" & count)
IE.Document.all("onetidDisplayOnLeftNo").Click
IE.Document.all("ctl00_PlaceHolderMain_onetidCreateSurvey").Click
Range("C" & count).Value = Stat
Range("D" & count).Value = link
End If
count = count + 1
End If
Loop
End Sub
Bookmarks