|
|
Thread Tools | Display Modes |
#16
|
|||
|
|||
I am updating this thread to ask an additional question, which I think is rather important. Is it also possible to use this macro with additional matching options available in the GUI or VBA? I am thinking of IgnorePunct and IgnoreSpace, but also searching for italics, for example. They are not technically wildcards, so I understand that this may be complicated or impossible. Thanks!
|
#17
|
||||
|
||||
You can add all manner of conditions; it just requires more columns for them to your workbook. If you're going to work with/without formatting parameters, you also need to set the Format property appropriately; setting italics, for example, wouldn't be enough on its own. See, for example, the discussion starting at: https://www.msofficeforums.com/word-...html#post93796
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#18
|
|||
|
|||
I understand, but I think it is overkill for what I need. More specifically, what I would need is to just search for italicised (just about everything), rather than searching for specific italicised words. I am not sure I am making any sense, though.
|
#19
|
||||
|
||||
In that case, insert:
.Format = True .Font.Italic = True before (or after): .Text = strFnd
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#20
|
|||
|
|||
Thanks! I have now tried it and the macro runs. However, it does not return any results (though it should have). I will investigate further. Paul (if I may) I am truly grateful for your help. You have already made my life significantly easier!
|
#21
|
|||
|
|||
I am bumping up this thread as I am now trying to do something different, that is to say, extract the expressions contained between certain marks. So, for example, I would like to extract the word "artist" if it is between three asterisks and three asterisks "***" And "***", like so:
***artist*** I understand that I would have to change something in this part of the code, but I have not been lucky so far. Code:
xlShtOut.Range("C" & j).Value = Replace(Split(.Paragraphs(1).Range.Text, vbCr)(0), vbTab, " ") .Start = .Paragraphs(1).Range.End Thank you! |
#22
|
||||
|
||||
You would have to change:
.Text = strFnd to: .Text = "***" & strFnd & "***"
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Thanks Paul! However, I think I have not made myself clear at all—my mistake, really.
My user case is a little more specific. Since most of the paragraphs I want to extract feature a reference, I thought I would first collect the references to then collect the paragraphs. To do so, I would use the fact that most paragraphs contain a reference written in italics. By finding all italicised text, I would be able to create a collection of search strings, from which I can then remove the duplicates to conduct the search. In this context, I would be looking for strings, not the complete paragraph The trouble is, as you told me above, searching for italics may be a problem. So I thought I'd replace all italic text with tags, such as the *** discussed above. (Though if there is a way to do this with italics, that would be amazing.) After doing that, I can either look for every string matching the *** tag (or italics, if at all possible) and create a list. Which will in turn allow me to search through my collection of documents. Does it make any sense? Again, thank you so much for contributing to this. |
#24
|
||||
|
||||
Searching for italicised text isn't a problem at all; you can even use italics as a Find parameter without specifying anything else about the text (i.e. you don't need to know what the text is). The only issue with the F/R using Excel as the source for the F/R expressions is that, if you want to find some text with/without a given attribute and other text regardless of that attribute, you'd need a column in Excel to hold those parameters.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
data extraction, regex |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exporting specific data fields from MS Word 2013 to a MS Excel 2013 spreadsheet | Labyrinth | Word | 7 | 07-19-2016 01:35 PM |
Exporting quiz scores from powerpoint to excel spreadsheet/word | rjagile | PowerPoint | 1 | 02-08-2016 02:26 PM |
Find and replace in word document repeated for every item in excel spreadsheet | Daniell | Word | 1 | 02-17-2015 04:38 AM |
Trying to import specific data from one spreadsheet to another, without matching rows | Wynka | Excel | 0 | 11-26-2014 09:33 AM |
Macro: Exporting Data to a LEGIBLE Excel Spreadsheet | jeffcoleky | Word VBA | 6 | 05-08-2012 08:24 AM |