#1
|
|||
|
|||
Macro to count and export results
Hello, I'm trying to find a macro for couting the number of instances of a text string, then export the results to a txt doc. We are looking to move to offsite printing, and will be merging all of the documents to one file, and there will be a trigger to advise of different mailings. The goal of the macro would be to count how many instances of that trigger there are and export it into a txt file so that we can track how many individual documents were sent to them |
#2
|
|||
|
|||
Sub ScratchMacro()
Dim arrContent() As String Dim strTrigger As String strTrigger = "zzz" arrContent() = Split(ActiveDocument.Range.Text, "zzz") Set oDoc = Documents.Add oDoc.Range.Text = Ubound(arrContent) End Sub |
#3
|
|||
|
|||
Thank you for your reply - So I would just replace the "zzz" with my variable? I tried and it just opens a new Word doc, but doesnt show any count or infomration, it is just blank
|
#4
|
|||
|
|||
Sorry, my mistake. Replace :
oDoc.Range.Text = lngIndex with oDoc.Range.Text = Ubound(arrContent) |
Tags |
export, macro, txt |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ammunition count macro | Owastell | Excel Programming | 3 | 07-03-2014 11:00 AM |
2013 search results take a long time - they fill in as results in reverse date order | themookman | Outlook | 0 | 10-11-2013 12:01 PM |
A recurring word count macro? | bpanda | Word VBA | 1 | 06-11-2013 07:17 AM |
Word Count Macro | bpanda | Word VBA | 1 | 01-11-2013 06:51 PM |
*Word 2007 Macro for Character Count | gbartlet | Word | 0 | 07-21-2010 11:12 AM |