Replace break Line in Excel
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-07-19 01:30 PM
Hello,
I want to create object which will replace charecters using ASCII Characters as arguments. I need this object to delete all line breaks in excel file ( Chr(10)).
My code stage does not work when I use ASCII characters:
range.Replace(Chr(115), Chr(100))
It works when I use strings:
range.Replace("s", "d")
Do you know how to create object to replace values using ASCII characters or how to delete all line breaks in excel sheet?
Chr(115) = "s"
Chr(100) = "d"
THE WHOLE CODE
Dim wb, excel, range As ObjectDim wb, excel, range As Object
Try
wb = GetWorkbook(Handle, Workbook)
excel = wb.Application
range = excel.Selection
'range.Replace("s", "d")
range.Replace(Chr(115), Chr(100))
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
excel = Nothing
range = Nothing
End Try
Thank you for your help
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
I want to create object which will replace charecters using ASCII Characters as arguments. I need this object to delete all line breaks in excel file ( Chr(10)).
My code stage does not work when I use ASCII characters:
range.Replace(Chr(115), Chr(100))
It works when I use strings:
range.Replace("s", "d")
Do you know how to create object to replace values using ASCII characters or how to delete all line breaks in excel sheet?
Chr(115) = "s"
Chr(100) = "d"
THE WHOLE CODE
Dim wb, excel, range As ObjectDim wb, excel, range As Object
Try
wb = GetWorkbook(Handle, Workbook)
excel = wb.Application
range = excel.Selection
'range.Replace("s", "d")
range.Replace(Chr(115), Chr(100))
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
excel = Nothing
range = Nothing
End Try
Thank you for your help
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-07-19 07:24 AM
Try this
range.Replace(vbLf, "")
------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-07-19 08:16 AM
Thank you it is working.
Break line is replace.
Do you know why ASCII Characters are not working for replace function ?
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
Break line is replace.
Do you know why ASCII Characters are not working for replace function ?
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
