Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-18-2020, 10:08 PM
John 4 John 4 is offline Mistake in the help file for String "Split Function"? Windows 10 Mistake in the help file for String "Split Function"? Office 2013
Advanced Beginner
Mistake in the help file for String "Split Function"?
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default Mistake in the help file for String "Split Function"?

Is there a mistake/typo in the help file here:
Split function (Visual Basic for Applications) | Microsoft Docs

Should "arrSplitStrings1()" and "arrSplitStrings2()" not be declared as Strings rather than Variants?
Code:
Sub Demo2()
Dim strFull As String
Dim arrSplitStrings1() As Variant
Dim arrSplitStrings2() As Variant
Dim str1 As String, str2 As String, str3 As String
Dim i As Long

    ' String that will be used:
strFull = "Some - Old - Hags - Can - Always - Hide - Their - Old - Age"

arrSplitStrings1 = Split(strFull, "-")
                                               
arrSplitStrings2 = Split(strFull, " - ")
                                                
str1 = arrSplitStrings2(3)      ' str1 = "Can".

str2 = Split(strFull, " - ")(3)       ' str2 = "Can".

For i = LBound(arrSplitStrings2, 1) To UBound(arrSplitStrings2, 1)
    If InStr(1, arrSplitStrings2(i), "Can", vbTextCompare) > 0 Then
        str3 = arrSplitStrings2(i)
        Exit For
    End If
Next i
End Sub

Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mistake in the help file for String "Split Function"? Replace " in string sent to output file gedinfo2020 Word VBA 3 02-27-2020 02:30 PM
"Split apart page break and paragraph mark" setting harry Word 10 12-18-2019 07:08 PM
Mistake in the help file for String "Split Function"? Keyboard toggle for switching between two split "screens" in Word 2010 BAEngelTranslations Word 4 10-26-2015 04:44 AM
Mistake in the help file for String "Split Function"? When Outlook starts, a warning box "String was not recognized as a valide datetime" twormington Outlook 4 02-03-2014 11:01 PM
Mistake in the help file for String "Split Function"? Macro VBA "Save as" with bookmarks in file name string Dom37 Word VBA 2 10-31-2011 03:28 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:06 AM.


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