Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2023, 07:53 AM
TheBigBoss TheBigBoss is offline Inconsistency with split(string, vbNewLine) Windows 10 Inconsistency with split(string, vbNewLine) Office 2016
Advanced Beginner
Inconsistency with split(string, vbNewLine)
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default Inconsistency with split(string, vbNewLine)

Same text in two different bookmark in MS Word, separating with hard return.

First bookmark, I split at vbNewLine, all good.
Second bookmark, vbNewLine fails, I must split at vbCr ?

Yet, same text, same doc??

Thanks for the help
Attached Files
File Type: dotm TEST_BETA.dotm (295.1 KB, 3 views)
Reply With Quote
  #2  
Old 06-17-2023, 08:31 AM
TheBigBoss TheBigBoss is offline Inconsistency with split(string, vbNewLine) Windows 10 Inconsistency with split(string, vbNewLine) Office 2016
Advanced Beginner
Inconsistency with split(string, vbNewLine)
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default

Very sorry, the project was protected.
Hope it is OK now. Thanks
Attached Files
File Type: docm TEST_BETA (1).docm (55.7 KB, 5 views)
Reply With Quote
  #3  
Old 06-21-2023, 06:29 PM
Guessed's Avatar
Guessed Guessed is offline Inconsistency with split(string, vbNewLine) Windows 10 Inconsistency with split(string, vbNewLine) Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm getting an unviewable project. Perhaps you can post your code here.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 06-24-2023, 06:39 AM
TheBigBoss TheBigBoss is offline Inconsistency with split(string, vbNewLine) Windows 10 Inconsistency with split(string, vbNewLine) Office 2016
Advanced Beginner
Inconsistency with split(string, vbNewLine)
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default

Hi Guessed,
Thanks for helping, sorry for that.
Let me do a last try with the file.

Same problem on my side, no access to macro.
I had to use the "Unblock a single file" in the doc properties before opening it??
a) Open Windows File Explorer and go to the folder where you saved the file.
b) Right-click the file and choose Properties from the context menu.
c) At the bottom of the General tab, select the Unblock checkbox and select OK.

If file is fine, please run "FillFields"
If not, well sorry, I will close the thread

I found a fix using this function
Code:
Function splitLineBreaks(ByVal str As String) As String
    str = Replace(str, vbCrLf, vbCr)
    str = Replace(str, vbLf, vbCr)
    splitLineBreaks = Split(str, vbCr)
End Function
In UserForm.Initialise(), look for these two lines (it appears twice as there is two bookmarks)
Code:
'dt = Split(CorNot1VenueDate, vbNewLine)
            dt = splitLineBreaks(CorNot1VenueDate)
The splitLineBreaks() function works... yet, a simple Split function at vbNewLine returns 2 for the first bookmark (this is perfectly fine) but 1 for the second bookmark (same code, same text with one hard return)??? Really puzzled why it fails?
Attached Files
File Type: docm TESTIT-SINGLEFILE.docm (103.2 KB, 2 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inconsistency with split(string, vbNewLine) Mistake in the help file for String "Split Function"? John 4 Word VBA 6 11-19-2020 06:02 AM
Inconsistency with split(string, vbNewLine) Mail Merge - split merged documents and rename each split document based on text in header FuriousD Word VBA 1 05-12-2019 04:06 AM
Split word file into several PDF using the bookmarks as split positions and name Fixxxer Word VBA 7 10-08-2018 01:10 AM
Inconsistency in Word Bibliography yoel Word 4 02-15-2015 02:24 AM
Inconsistency with split(string, vbNewLine) Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM

Other Forums: Access Forums

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


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