Mepwnz2010
New Member
- Joined
- Aug 20, 2014
- Messages
- 9
I'm trying to automate a web page for work, and up until a week ago I didn't even know what VBA is. I've got as far as checking all the cells to make sure the user filled them out and then pulling the web page to the focus of the macro. Next I need to click a btn and ultimately I will need to click a few btns operate some drop down boxes and fill in some text. I've been working on this button for a while and I don't seem to be getting anywhere. I can't link the url cause its for work, and you would need a log in anyways. But I i will link my macro code used so far, and the code for the button.
Code:
' Arguments:
' Title - title of the searchied IE window
' [IsLike] - False/True = exact/partial searching, default is False
' [IsFocus] - False/True = don't_activate/activate IE window, default is False
Function GetIeByTitle(Title, Optional IsLike As Boolean, Optional IsFocus As Boolean) As Object
Dim w As Object
For Each w In CreateObject("Shell.Application").Windows
With w
If .Name = "Windows Internet Explorer" Then
If IsLike Then
If InStr(1, .LocationName, Title, vbTextCompare) > 0 Then ' ZVI:2013-09-10 fixed
' Partial title of window is found - activate IE window
If IsFocus Then
w.Visible = False
w.Visible = True
End If
Set GetIeByTitle = w
Exit For
End If
Else
If StrComp(.LocationName & " - " & .Name, Title, 1) = 0 Then ' ZVI:2013-09-10 fixed
' Title of window is found - activate IE window
If IsFocus Then
w.Visible = False
w.Visible = True
End If
Set GetIeByTitle = w
Exit For
End If
End If
End If
End With
Next
Set w = Nothing
End Function
'---------everything above here sets up rules for the macro---------------------
Sub CreateSFcase()
If IsEmpty(Range("a1")) Then
MsgBox "No. of Bookings is blank" & """", 48
Stop
End If
If IsEmpty(Range("a2")) Then
MsgBox "Dispute Amount is blank" & """", 48
Stop
End If
If IsEmpty(Range("a3")) Then
MsgBox "Transaction Post Date is blank" & """", 48
Stop
End If
If IsEmpty(Range("a4")) Then
MsgBox "Accounting Assigned To is blank" & """", 48
Stop
End If
If IsEmpty(Range("a5")) Then
MsgBox "Contact/Account Lookup Results is blank" & """", 48
Stop
End If
If IsEmpty(Range("a6")) Then
MsgBox "Contact/Account Lookup Results is blank" & """", 48
Stop
End If
If IsEmpty(Range("a7")) Then
MsgBox "Additional To is blank" & """", 48
Stop
End If
'-------------------------------------Everything from to the above green line checks to make sure macro is completely filled out before running the marco---------------------------------------------------------
Dim ie As Object
Dim Title As String
Title = "New Case: Select Case Record Type ~ Salesforce.com - Unlimited Edition"
Set ie = GetIeByTitle(Title, True, True)
If ie Is Nothing Then
MsgBox "Please open the correct Salesforce window" & vbLf & """" & Title & """", 48
Stop
End If
'---------------------------------this pulls up SF---------------------------------------------
End Sub
Code:
<td class="pbTitle">...</td> 'this looks like its the background behind my btn
<td class="pbButton" id="bottomButtonRow"> 'this looks like its the background behind my btn
<input value="Continue" class="btn" title="Continue" name="save" type="save"> 'this is my btn