I have an excel sheet, in which text has been formatted, and the format has a "meaning". For example text formatted as "Strike-through" means the text is deleted.
I now need to import this into Access 2003, and I need the values in Access to not include the text marked as deleted. Therefore I would like to do a search and replace in Excel to remove all text marked with strikethrough. Any idea how to accomplish this?
Each cell can have multiple different formats, just to compliace things. Unlike Access where each cell can only have 1 format.
With love, TheSmileyOne
I found out there is a property called Charecter which can be used on Range. - Public Sub DeleteStriked(myRange as Range)
-
Dim intI as Integer
-
Dim strNew as string
-
for intI=1 to len(myRange)
-
if myRange.Charecters(intI,1).font.Strikethrough then
-
'We dont want this text
-
Else
-
'We do want this text
-
strNew=strNew & myRange.Charecters(intI,1)
-
End if
-
next
-
End Sub
I can now use this function to remove the striked out text. Thank you for your help, both Jim who posted, and all those who took the time to look at this.
4 4572 @TheSmileyOne
Quick and dirty ...set your own sheet name and ranges if it helps you :) - Function BlitzStrikeThrough(strfile As String)
-
Dim xlApp As Object, xlWB As Object, IStartedXL As Boolean
-
On Error Resume Next
-
Set xlApp = GetObject(, "excel.application")
-
On Error GoTo here
-
If xlApp Is Nothing Then
-
Set xlApp = CreateObject("excel.application")
-
IStartedXL = True
-
End If
-
Set xlWB = xlApp.Workbooks.Open(strfile)
-
With xlApp.Worksheets("Sheet1")
-
.Range("A1:H100").Select
-
With Selection.Font
-
.Strikethrough = False
-
End With
-
.Range("A1").Select
-
End With
-
here:
-
xlWB.Close True
-
If IStartedXL Then xlApp.Quit
-
Set xlWB = Nothing
-
Set xlApp = Nothing
-
End Function
Thanks for your effort Jim, but thats not quite what I need. I don't need to remove the formatting, I need to remove the text parts that has a specific format. I.e. If its formatted as strikethrough, I need to delete that part of the text, without deleting the entire cell.
Basicly for each charecter in the cell, I need to check if its StrikeThrough, and if so, delete it. (Not the cell, the specific charecter.
I found out there is a property called Charecter which can be used on Range. - Public Sub DeleteStriked(myRange as Range)
-
Dim intI as Integer
-
Dim strNew as string
-
for intI=1 to len(myRange)
-
if myRange.Charecters(intI,1).font.Strikethrough then
-
'We dont want this text
-
Else
-
'We do want this text
-
strNew=strNew & myRange.Charecters(intI,1)
-
End if
-
next
-
End Sub
I can now use this function to remove the striked out text. Thank you for your help, both Jim who posted, and all those who took the time to look at this.
@TheSmileyOne
Elegant solution :) I obviously misunderstood your original..... apologies
Sign in to post your reply or Sign up for a free account.
Similar topics
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the...
|
by: Pete from Boston |
last post by:
I'm going through some "learning by doing" of javascript through trial
and error, and admittedly have a lot to learn. But in taking various
scripts and dissecting them, I still can't figure out if...
|
by: mr_ocp |
last post by:
Hi friends
I need routines to create an excel file with worksheets for each
customer and a text file as well for each customer, first worksheet
would be a "Summary Report", here is the code that...
|
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the...
|
by: bienwell |
last post by:
Hi all,
Do you have any source code to import data from Excel file or text file into
database in ASP.NET program ? Please give me your reference if you have.
Thanks in advance
|
by: vijay mathews |
last post by:
hi i am developing a chat application tool for a company
i have a problem..... i have written codings for text formatting such as color, size etc in vb.net..... but when it is connected to a...
|
by: Harry Haller |
last post by:
Can I remove text from a StringWriter ?
I have a StringWriter object, the content of which looks like this:
"<div>Some other html which I wish to keep</div>"
Can I remove the unwanted <div>,...
|
by: minhtran |
last post by:
Hi all
Anyone has any idea how to get a Excel header column in VB.NET. Please, help me. Thank you so much in advance
|
by: =?Utf-8?B?b24tbGluZSBqb3VybmFsIGVkaXRvcg==?= |
last post by:
I can't seem to cut-and-paste text, with either .doc or .html formatting,
into my .asp web-pages --all the formatting is lost. Is there some code that
needs to be added to the page that will...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |