Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2014, 08:49 AM
rm7885 rm7885 is offline Macro to count and export results Windows XP Macro to count and export results Office 2010 32bit
Novice
Macro to count and export results
 
Join Date: Jul 2014
Posts: 3
rm7885 is on a distinguished road
Question 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
Reply With Quote
  #2  
Old 07-23-2014, 12:14 PM
gmaxey gmaxey is offline Macro to count and export results Windows 7 32bit Macro to count and export results Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,599
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 07-23-2014, 12:25 PM
rm7885 rm7885 is offline Macro to count and export results Windows XP Macro to count and export results Office 2010 32bit
Novice
Macro to count and export results
 
Join Date: Jul 2014
Posts: 3
rm7885 is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 07-23-2014, 12:41 PM
gmaxey gmaxey is offline Macro to count and export results Windows 7 32bit Macro to count and export results Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,599
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Sorry, my mistake. Replace :
oDoc.Range.Text = lngIndex
with
oDoc.Range.Text = Ubound(arrContent)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Tags
export, macro, txt

Thread Tools
Display Modes


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
Macro to count and export results A recurring word count macro? bpanda Word VBA 1 06-11-2013 07:17 AM
Macro to count and export results 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:11 PM.


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