Microsoft
Software
Hardware
Network
Question : Simple VBA question
The following code will create a string StrHeading of selected items from an Access listbox. If the items selected are Red, Green and Blue, StrHeading will be "Red,Green,Blue". How do replace the right most comma with 'and' to make it "Red,Green and Blue"?
For Each varItem In ctl.ItemsSelected
StrHeading = StrHeading & ctl.ItemData(varItem) & ", "
Next varItem
If Right(StrHeading, 2) = ", " Then
StrHeading = Left(StrHeading, Len(StrHeading) - 2)
End If
' ...statement-to-replace-la
st-comma-w
ith-" and"-here....
Answer : Simple VBA question
Apologies simple mistake on my part, mid$ needs 1 as the start parameter
Dim pos As Integer
pos = InStrRev(StrHeading, ",")
If pos > 0 Then
TextBox2.Text = Mid$(StrHeading,1, pos - 1) & " and " & Mid$(StrHeading,pos + 1)
End If
Random Solutions
ARP Blocking with in the domain.
setting margins
Exchange 2010 setup.com /preparead fails
Regular Expression needed to parse a string of multiple colons and extract an element-revised
Not downloading Offline address book files. A server (URL) could not be located. 0X8004010F
Need Excel VBA macro code to projected next number in a row of numbers using least squares best fit
Polycom ViewStation EX Network setup
How do I get the F6 storage drivers to work on a 8100 Elite Convertable Mini Tower?
Need small help
how can i get a list of client inbox rules through powershell