List of fonts used in a Word doc -- the easy way

The VBA scripts that I have found all implement a character-by-character scan throu=
gh the document, which can take a long time in later versions of Word. You can blame Wor=
d's "formatting" feature for the slowdown.

There=E2=80=99s a faster way: Save the document in .rtf format, then open the .rtf fi=
le in a text editor such as notepad.exe.  The fonts are listed in a font table ( {\fonttb=
l ) located at the very beginning of the file.  Each font entry looks something like thi=
s: =


{\f0\froman\fprq2\fcharset0 Times New Roman;}

Any entries with a character set other than \fcharset0 can be ignored.

(To make it easier to read the temporary rtf file, search for "{" and replace with "<ne=
wline>{", where <newline> means CRLF in Windows, or CR in linux.  I dunno what it is in M=
ac.)

Word, of course, doesn=E2=80=99t follow Micro$oft=E2=80=99s own RTF specificati=
on exactly, so sometimes there will be extra tokens (text embedded between braces) w=
ithin the font token.

I wrote a VBA macro that extracts the font names. I'll post the macro here (or email it)=
 if anybody's interested.

-sadhu!

url:http://www.ureader.com/gp/1022-1.aspx
0
Harry
2/28/2010 4:03:14 PM
word.vba.general 1023 articles. 1 followers. Follow

1 Replies
1369 Views

Similar Articles

[PageSpeed] 46

There is a reason to do a character by character scan: your method will also 
return template fonts which might not be in use in the text but are still 
part of the document.

On a side note, assuming Word 2007, in VBA you can just use the OpenXML 
method and query that for the w:fonts element which contains a list of 
w:font elements which are the same as what your 'fcharset0' collection will 
return. This way, you won't have to save to an external file and parse that 
one.

Yves

"Harry Hondalf" <mald_guy_44@yahoo.co.in> wrote in message 
news:f82e81c7e248446da180208241e1b713@newspe.com...
The VBA scripts that I have found all implement a character-by-character 
scan through the document, which can take a long time in later versions of 
Word. You can blame Word's "formatting" feature for the slowdown.

There’s a faster way: Save the document in .rtf format, then open the .rtf 
file in a text editor such as notepad.exe.  The fonts are listed in a font 
table ( {\fonttbl ) located at the very beginning of the file.  Each font 
entry looks something like this:

{\f0\froman\fprq2\fcharset0 Times New Roman;}

Any entries with a character set other than \fcharset0 can be ignored.

(To make it easier to read the temporary rtf file, search for "{" and 
replace with "<newline>{", where <newline> means CRLF in Windows, or CR in 
linux.  I dunno what it is in Mac.)

Word, of course, doesn’t follow Micro$oft’s own RTF specification exactly, 
so sometimes there will be extra tokens (text embedded between braces) 
within the font token.

I wrote a VBA macro that extracts the font names. I'll post the macro here 
(or email it) if anybody's interested.

-sadhu!

url:http://www.ureader.com/gp/1022-1.aspx 

0
Yves
2/28/2010 5:24:30 PM
Reply:

Similar Artilces:

Can I fade the edges of photos that I use?
I am trying to use photos in a publisher document that I want to fade the edges of, is this possible to do with publisher? -- D:o) krazy-4-coke wrote: > I am trying to use photos in a publisher document that I want to fade the > edges of, is this possible to do with publisher? Not really. You should use dedicated image manipulation software for this, such as Photoshop Elements, Paint Shop Pro, or Microsoft Digital Image. -- Ed Bennett - MVP Microsoft Publisher http://ed.mvps.org Ed, Are any of these programs typically come loaded on a computer?? I have another question - ca...

exchange 2003
I just set up a mail server at things are working fine in the network where it resides. The issue is that I have 5 other buildings that are connected via a VPN, and they can not connect. Do I need to change settings at their locations? DNS?? WINNS??? It depends on type of client, but generally proper DNS setup is required. Also make sure that no firewalls interfere. laker18 wrote: > I just set up a mail server at things are working fine in > the network where it resides. The issue is that I have 5 > other buildings that are connected via a VPN, and they > can not co...

Using different form strings to filter
Hello. Is there a way to code a query to have it use a filter string if a form is open, or ignore it if the filter is not open? Example: Query Name: Query1 Form: Form1 and Form2 Query fields: Field1 and Field2 I have a string in field 1 and 2 Forms!Form1!Field1 in the first field of the query, and Forms!Form1! Field2 in the second field. Can I also have Forms!Form2!Field1 in the query as well? I have tried this, but a box pops up and asks for the information from form 2 when it is not open. Thank you. hi, nybaseball22@gmail.com wrote: > Hello. Is there a way to code a query to...

transfer inbox in table format to word
In my older version I could cut and paste the table format in Outlook to a word file. Now I don't seem to be able to do it although I can print the file in that format within Outlook. When I export the inbox to word I get the whole text not just the headings. Is it possible to transfer the table format to a word file? ...

SMTP address list
Does anyone know of a way to obtain a list of all SMTP email addresses accepted by a server and the corresponding user account in Exchange 2003? Thanks Brad Palmer You can use LDIFDE to dump Active Directory attributes to a text file. The email addresses are held in the 'proxyAddresses' attribute, so: ldifde -f dump.ldf -l proxyaddresses This will give you a file called dump.ldf containing your addresses. You can add other Active Directory attributes to the export file as you see fit. -- Neil Hobson Exchange MVP For Exchange news, links, and tips, check: http://www.msexc...

using beforeprint
I am trying to get an application to append a file on a sheet printout. I am using Workbook_BeforePrint. It prints fine, but doesn't seem t execute the sub. What's wrong -- Message posted from http://www.ExcelForum.com Hi you may post your existing code :-) Also check that you have put this code in your workbook module ('ThisWorkbook') -- Regards Frank Kabel Frankfurt, Germany > I am trying to get an application to append a file on a sheet > printout. I am using Workbook_BeforePrint. It prints fine, but > doesn't seem to execute the sub. What's wrong?...

Using Ghost as OS Backup
I attended a class a while back where the exchange admins said they used Ghost to clone the OS drive. I bought the product and it says that during the clone process it temporarily removes the server from the domain. Has anyone done this or had any problems? Thanks, Fred On Mon, 21 Nov 2005 05:26:28 -0600, "Fred T" <fredt2@mail.com> wrote: >I attended a class a while back where the exchange admins said they used >Ghost to clone the OS drive. I bought the product and it says that during >the clone process it temporarily removes the server from the domain. ...

Do you need Access to use an Access Database for data entry only?
We have an Access database completed. Now we will use it for reading as well as for data entry. Do we need to install Access for every workstation needing the database for data entry or reading? No you don't necessarily need Access on every computer. You CAN use the Access Runtime and if it is in Access 2007 you can use it for free. If you are using another version then you would need to purchase the developer's edition to be able to legally distribute the associated Access runtime. If you do have 2007 and want to use the runtime, make sure your Full version of Access doe...

DPM sometimes uses too many tapes
Hi, i have problem with DPM long term backups on tape. I have collocation enabled so that is not a problem. Sometimes DPM uses too many tapes for same protection group, sometimes it uses 1, and then sometimes 2 - 4. Amount of data is always same. Can anybody help me please, what could be the problem? Hi Tornado, Can you explain protection group configurations as well as tape usage in detail, so that we can analyze on what is happening? Thanks, Jyothsna[MSFT] This posting is provided "AS IS" with no warranties, and confers no rights. "Tornado" <Torn...

How do I add a hyperlink to an individual word in an Excel cell?
I am using Excel 2000 (not by choice) and I need to add a hyperlink to an individual word within the cell, not the whole cell itself. For example in the sentence "Click here or here to go to the appropriate web page." I want the words "here" to each have a separate hyperlink. Any ideas? I can manage some VBA too if necessary. Thanks, Rosalie Hi Rosalie, You can't do that in Excel. You would have to use HTML or Word or some other means. You could fake it, the entire cell would be a link, but you could after assigning the hyperlink select another...

is there any way I can trap for the use of navigation buttons?
Hi Is there any way I can trap for the use of navigation buttons, such as Next, Previous and New record? Stapes Probably. Trap what and when? "Stapes" <steve.staple@gmail.com> wrote in message news:7fe0fd6b-0da1-495e-a369-29bc72ca3af9@s8g2000prg.googlegroups.com... > Hi > > Is there any way I can trap for the use of navigation buttons, such as > Next, Previous and New record? > > Stapes On Wed, 16 Jan 2008 05:14:20 -0800 (PST), Stapes <steve.staple@gmail.com> wrote: No. And there shouldn't be a reason for that. There are plenty of events in...

Cannot stop using online services with First Tech Credit Union
My bank, First Tech Credit Union, recently upgraded their online banking services. This upgrade also included a change to the user name and password used for online banking in Money 2006. Their upgrade instructions (http://www.firsttechcu.com/help/help_guide_money.html) say to disable online services for your Money file as the third step to upgrading to the new services. The problem is that when I click on Stop Using Online Services in Money nothing happens. I click on OK and Money hangs for a bit then comes back with no change, clicking on OK again has the same effect, clicking on ...

Using paste in macro but with variable references.
Hi all, I am trying to use the paste function in a macro but it needs to be variable. I have split a list of data (team workloads) into the seperate teams and by days of the week. I now need the macro to compile one book with all the data in order. The headings for each team are already set on a worksheet so the data needs to be entered under each heading For example: Team A Day 1 under the heading "Team A Day 1", Team B Day 1 under the next heading on the same sheet "Team B Day 1". I hit problems as the workload ammount will alter from week to week. So of course asking...

How do insert name automatically atop of each pg of doc?
Hello, How do I automatically insert name on each page of document like inserting page numbers? My professor told me not to type it in but to insert and I have not been able to do so. This is a new program for me, Word 2007. I have to submit my paper in MLA form and do not wish to lose points because for this. Thanks for your help. Click on the Insert tab of the Ribbon and then in the Header and Footer section, click on Header and make your choice from the options presented or click on the Edit Header button to get a blank header pane in which to insert the name in the...

Using CComboBox embedded in CToolBar
Hi, I've derived a class from CToolBar and overridden OnCreate to replace 2 placeholder buttons with 2 combo boxes. The two combo boxes are also derived from CComboBox, and populate themselves with appropriate strings. My problem is that I'm not sure of how to inform my application when the user has selected a new item in one of the combo boxes. I've added a handler for the CBN_SELCHANGE message to the CComboBox, but I don't know what to put in it. What is the best way to forward the message to the mainframe? Also, when I replace the placeholder buttons, can I reuse their ...

audio notes in Word Notebook
I have recorded an audio file using Word Notebook. I would like to send the audio file to co-workers but they cannot seem to open it. Any ideas Are your co-workers using Word 2004? Only Word 2004 can open documents in Notebook Layout view and use the special features like audio, I think. However, you could use Tools | Audio Notes | Export audio to get just the audio file out, I think it comes out as an .mp4 Then send that around, it should be a standard format that most any audio program can play, far as I know. On 9/14/06 11:09 AM, "healy@parentchoice.org" wrote: > I h...

Adding Members- Dist. Lists
Not sure if I should be posting this here or in the SBS group. Does anyone know if there is a way to assign a permission to a user in our office to be able to update membership lists for distribution groups while she is in Outlook? Currently, when she clicks the "To:" button in a new email, right-clicks the distribution group, selects properties, goes to "modify members", it lets her select the new member but then when she clicks ok she will get an error mssg saying she doesn't have permission to do this. thx! on the security tab of the DL, does she have the &qu...

Output the list of frequent data
Dear all, Here comes two problems. Problem 1: I have a list of strings (say, in the column A1:A100). How can I find the "mode" (i.e. the string appearing most frequently in the list? For example, if the list is APPLE APPLE BANANA APPLE CREAM CREAM BANANA CREAM APPLE DONUT then I want the result is APPLE. It seems that the MODE function does not suppot data type other than numbers. Is there any canned UDF for it? Problem 2: Following Problem 1, I want to generate a list of the 3 most frequent data in the list. If the list is the one in the example, I want to list to be...

is there a way of using a second monitor as a customer display
This is a multi-part message in MIME format. ------=_NextPart_000_018F_01C86B1D.3EAD2F60 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, Does anyone know if rms works with 2 monitors. What I mean can you use a second monitor as customer display or something similar. A lot of pos systems out there use a second monitor as customer display, I m not sure if rms supports that option or not but any help would be appreciated. thanks ------=_NextPart_000_018F_01C86B1D.3EAD2F60 Content-Type: text/html; charset="us-ascii" Content-Transfer-...

Creating Charts for Use in Powerpoint
I have a series of charts that I need to create for a Powerpoin presentation. I thought it would be easy to just create the charts/graphs in Exce and then just cut and paste to the PP-Slides. I'm finding that it isn' quite that easy. Here are some of my problems that I hope someone might be able to she some light on and give me some direction. 1. In Excel how do you control the size of the chart? - When I create a chart 1 and define the data ranges I get a goo looking chart then I thouht, why reinvent the wheel so I just copy th chart to create chart 2 and change the data range, but...

Re:Help with verifying the signature of enveloped -message using x509 certificates.
Re:Help with verifying the signature of enveloped -message using x509 certificates. Hey Friends, I have an xml given by our partner trying to integrating with us and i have their certificate with public key installed in both personal and trusted people folders. when i am using the following code to check the signature of message signed by my certificate i am able to verify the signature but when i am trying to check the signature of the message of our partner using the same following code i am not able to verify the message. the message sent by our partner is right below the code.I wou...

Update table with Multi-select list box
I have a database with a tab control that has several pages in it (my boss loves tabs for navigation). Each page has a list box based on a category of training events that members of my office attend and the box is based on a query that selects the training events for the tab page's respective category. I select an item from the list, click a button, and go to a form with a text box showing the name of the training event I previously selected. On that form, I want to select mutiple names of office members from a list box (already created and source is the Office Roster table) and then c...

Merge data from Acces to word
I have an Access db with records on a form which I want to export to a Word Template with predifened fields. How can I do that? reidarT Take a look at Albert D. Kallal's Super Easy Word Merge at http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html -- Hope this helps, Daniel Pineault "ReidarT" wrote: > I have an Access db with records on a form which I want to > export to a Word Template with predifened fields. > How can I do that? > reidarT ...

Putting Excel Charts into a Word document that's getting too big
I am creating a Word document (our Annual Report) in which I will have many charts and graphs that were created in Excel. Currently, there will be at least 26 graphs/charts in the document. In the past, there have apparently been problems with not having enough space to save the Word document because it gets too big. The document itself is only about 36 pages, but, as I mentioned, within the 36 pages are at least 26 graphs and charts. I'm looking for a way to copy the graphs/charts into Excel without it taking so much memory. One solution we thought of was to only paste the gra...

How do I create a chart in Excel using data from two worksheets
I am trying to create a chart using data from two separate worksheets but it will only allow me to use the information from one. Here is one way: I made a chart from data in A10:B20 on sheet1 (A was the x-category data) I copied some cells from Sheet2, right clicked in chart area of chart and used Paste After the copy, I could have left clicked the chart and used Edit | Paste Special to specify more about the data I want to paste. Try it and come back with more questions. best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "cdptuesdays" <...