Home |
Search |
Today's Posts |
#1
|
|||
|
|||
[newbie] word counts.. and excluding stuff..
Hi there,
Loads of posts on here of word counts but I can't get any of them to work for some reason.. think It might be because im running office on a mac.. (by the way, apologies for this post - it might "help" if my office "help" worked to show me the VBA help page - It just loops round between "Visual Basic Editor Reference Help" and "Visual Basic Help" when you click on a link.. grr.. anyway side issue..) What I want to do is be a bit of smart arse. My college say that we can exclude citations from the word count. Citations are always in Brackets and almost always end in a 4 digit year (Lets just say they always do for this..) so asdasda (adasad adsad ads 2004) might be a citation or (adsa 2002) Now my knowledge of VB goes back to some archaic ASP form from years ago - and I have no idea of where to start with this.. Any pointers much appreciated.. thanks - and apologies for the possible double posting - Just cant find anything that does this job will |
#2
|
|||
|
|||
If you want to do this via VBA, you should ask on a newsgroup with VBA or
Programming in the name. If you are on a Mac, you should probably ask on the Mac-specific newsgroup as wildcards are a bit different on the Mac. Either way, you need to rewrite your question so that it is clear what you want to do, and what you already tried that didn't work. And you need to state your version. See here for Google/Entourage gateway to Mac-specific ngs: http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups On 5/22/05 2:53 PM, " wrote: Hi there, Loads of posts on here of word counts but I can't get any of them to work for some reason.. think It might be because im running office on a mac.. (by the way, apologies for this post - it might "help" if my office "help" worked to show me the VBA help page - It just loops round between "Visual Basic Editor Reference Help" and "Visual Basic Help" when you click on a link.. grr.. anyway side issue..) What I want to do is be a bit of smart arse. My college say that we can exclude citations from the word count. Citations are always in Brackets and almost always end in a 4 digit year (Lets just say they always do for this..) so asdasda (adasad adsad ads 2004) might be a citation or (adsa 2002) Now my knowledge of VB goes back to some archaic ASP form from years ago - and I have no idea of where to start with this.. Any pointers much appreciated.. thanks - and apologies for the possible double posting - Just cant find anything that does this job will -- Daiya Mitchell, MVP Mac/Word Word FAQ: http://www.word.mvps.org/ MacWord Tips: http://www.word.mvps.org/MacWordNew/ What's an MVP? A volunteer! Read the FAQ: http://mvp.support.microsoft.com/ |
#3
|
|||
|
|||
Sorry, that was a bad request wasnt it.
Ok its basically the same as this thread : http://groups-beta.google.com/group/...e2629bdea50e26 below is my current code. It's all fine - it will get everything that has (*) but what I really want is (* nnnn) where n= 4 digits. I cant work out how I should be writing the Find.Text = "\(* 0-90-90-90-90-9\)" (thats my stab at it but guess what - it doesnt work) All works fine on the mac in the end - my fault.. it was copying and pasting from safari with gremlins causing word to throw a fit Sub countw() ActiveWindow.View.ShowHiddenText = False Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "\(*\)" .Replacement.Text = "^&" .Replacement.Font.Hidden = True .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute replace:=wdReplaceAll Selection.WholeStory MsgBox "There are " & Selection.Words.Count & " words." ActiveWindow.View.ShowHiddenText = True Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "*" .Font.Hidden = True .Replacement.Text = "^&" .Replacement.Font.Hidden = False .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute replace:=wdReplaceAll Selection.WholeStory MsgBox "There are " & Selection.Words.Count & " words." ActiveWindow.View.ShowHiddenText = False End Sub |