Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #31  
Old 07-08-2020, 06:29 PM
gmaxey gmaxey is offline Help with cascading dropdown list Windows 10 Help with cascading dropdown list Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You could pass it to a funtion:


Code:
Sub TestATS()
Dim arrTest() As String
  arrTest = Split("A", "|")
  MsgBox fcnArrayToString(arrTest)
  arrTest = Split("A|B", "|")
  MsgBox fcnArrayToString(arrTest)
  arrTest = Split("A|B|C|D", "|")
  MsgBox fcnArrayToString(arrTest)
  MsgBox fcnArrayToString(arrTest, True)
End Sub

Public Function fcnArrayToString(varIn As Variant, Optional bOxford As Boolean = False) As String
Dim strTemp As String
Dim lngIndex As Long
  Select Case UBound(varIn)
    Case 0: fcnArrayToString = varIn(0)
    Case 1: fcnArrayToString = varIn(0) & " and " & varIn(1)
    Case Else
      fcnArrayToString = varIn(0)
      lngIndex = 1
      Do While lngIndex < UBound(varIn)
        fcnArrayToString = fcnArrayToString & ", " & varIn(lngIndex)
        lngIndex = lngIndex + 1
      Loop
      If bOxford Then
        fcnArrayToString = fcnArrayToString & ", and " & varIn(lngIndex)
      Else
        fcnArrayToString = fcnArrayToString & " and " & varIn(lngIndex)
      End If
  End Select
lbl_Exit:
  Exit Function
End Function
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list, Macro shield5 Excel Programming 7 10-27-2013 01:51 AM
VBA: How to place dropdown list next to text YigalB Word VBA 0 08-11-2013 01:48 PM
block selection in dropdown list Intruder Excel 2 01-10-2013 10:20 AM
Help with cascading dropdown list dropdown list for documents r_p_t_0 Word 2 12-18-2012 05:55 AM
Dropdown list of email addresses J Partridge Outlook 1 01-13-2011 06:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft