Macro to count inline images

I have to format about 10000 word docs that are generated from another source 
for a test report. I have built a a macro to do the formating for me but I 
would rather make it more automated. I have two differnt reports, the only 
difference between them is the number of inline objects. 

1. How do I count the number of inline objects?
2. How do I automate word to run the module on a directory (including 
sub-directories)
3. How to Save-as in order to maintain the originals?

Thank you!
0
Utf
3/25/2010 3:05:01 PM
word.docmanagement 5542 articles. 2 followers. Follow

1 Replies
1352 Views

Similar Articles

[PageSpeed] 3

Hi Tith,

For a given document, you can use a macro like:
Sub InlineShapeCount()
Dim i As Integer, oRng As Range
With ActiveDocument
  For Each oRng In .StoryRanges
    i = i + oRng.InlineShapes.Count
  Next
End With
MsgBox "This document has " & i & " Inline Shapes."
End Sub

-- 
Cheers
macropod
[Microsoft MVP - Word]


"Tith" <Tith@discussions.microsoft.com> wrote in message news:8E596209-EF2E-443B-BB29-8D9C6AE0A70D@microsoft.com...
>I have to format about 10000 word docs that are generated from another source 
> for a test report. I have built a a macro to do the formating for me but I 
> would rather make it more automated. I have two differnt reports, the only 
> difference between them is the number of inline objects. 
> 
> 1. How do I count the number of inline objects?
> 2. How do I automate word to run the module on a directory (including 
> sub-directories)
> 3. How to Save-as in order to maintain the originals?
> 
> Thank you!
0
macropod
3/25/2010 8:50:24 PM
Reply:

Similar Artilces:

How to avoid down loading an image
I want an aspx page to first call a sub that uses confirm() to ask the user if he want an image displayed. Something like I show below. I could have check() simply use window.location to go to the next page if the user refuses and to return if he says to display the image. However, even if he refuses the image has already been down loaded which is should not happen if the user says "no".. How would you do this? Thanks <asp:Content runat="server" ID="Content4" ContentPlaceHolderID="BottomCPH"> <<script t...

A little help please on a macro to display results.
I have the code listed below that searchs a folder and if it finds any PDF files its displays them with a hyperlink in the spreadsheet. My problem is that under the MAIN folder I have tons of files now and its very hard to find the PDF I am looking for.. I redid my file structire under main and now I have folders for years 2010, 2012,2013,2014,2015 and so on. Under each years directory are the directories for the 12 months of the year & under each of these months I have two folders A-cast & B-cast. What I would like is that the code could search the folders starting for...

Buttons - Macros
I would like to make a button for a contact form that takes information from the contact form and enters it automatically into an email. The buttow would be called PROFILE and when depressed or clicked would take, First Name, Last Name, email address, phone number and a number of other fields from the contact form and would automatically enter them into an email so it looks like this: PROFILE: Full Name: Jeff Strachan email: jeff@footprintsrecruiting.com home phone: (604) 677-6556 Anyone have any ideas? I suspect I have to create a macro but I have never tried to make one before......

'Assign Macro' dialog missing in Excel XP
I'm trying to assign a macro to a command button, however the 'Assign Macro' dialog is missing from the context menu when right clicking the button. I have only been to do it when having opened an old worksheet (created in excel 97) with existing command buttons & macros, then the option is there to assign a macro. I have searched the net for a solution however to no avail. I know it is possible since Excel Help states that is the official way to do it. I have office Xp installed with service pack 2. I hope you will be able to help me. Thank you It's possible ...

Problem with a macro and rectangle
Hi, guys I have this macro that puts an object (rectangle shape) of a size that represents 24 inside a range of cells The problem is that the X,Y position of the object isn=B4t always the same. So, for example, if we put a rectangle with a size of 190, its default value is 630. What I want to do is that the value 190 gets saved when the new macro is run again and if it changes to 240, this would be the default vakue for the next time the macro is run. I don=B4t know if this is too difficult. Thank you so much. One way would be to put the value in a cell and read it. 1234 ...

'advanced filter/unique values only' inaccurate counts
i often have to use filters to reduce a column of numbers to just it's unique values. simple enough, but unfortunately excel's advanced filter doesn't always do the job and leaves out values or just doesn't filter correctly. i'm hoping there's a simple explanation for this and the filter can be made more reliable. any thoughts? The filters are reliable, so there may be a problem with the data. For example, a space at the end of a text string can cause two cells that look the same to be extracted by the filter. Perhaps you can give an example of what's left out, ...

Imaging software compatible with Access
Does anyone know if an imaging software package that is compatible with Access? I want to be able to scan documents into access as attachments to a certain tracking number for a discrepancy database. Any insight would be appreciated. Let me rephrase the question... We are designing a database to track discrepancies. We want to be able to scan an image of the documents into the database attached to a tracking number. What imaging software do you suggest would be best for this function? Butterfly4385 wrote: >Does anyone know if an imaging software package that is compatible with >Acces...

Opening a Word Document via a macro
Can anyone provide me with some code for a macro to open a wor document. I have excel2000, and word 2000, running on xp. I have tried what has been suggested previously, something like: Sub WDTest() Dim WD as Object Set WD = CreateObject("Word.Application") WD.Documents.Open "C:\My Documents\WordDoc.Doc" End sub but this has caused me many problems. I get the error message tha "WordDoc.doc" has been locked for editing by me. I have tried it on number of otherwise fine documents (before I run this macro, I coul open them normally) After I have run the macro...

The blank cells i need to count have formilas in
How do i write a fromula to add together diffeent ranges of cells that will count blank cells even if the blank has a formula in it. f 17:f12 + g23:g30+h5:h10 = 8 using excel 2007Vista Hi Rubber, If the blank cells with a formula in them has the value of zero, use COUNTA to count the cells and COUNTIF to count the zero values in each range, then subtract the two. =COUNTA(F12:F17)-COUNTIF(F12:F17,0) or fully =COUNTA(F12:F17)-COUNTIF(F12:F17,0)+COUNTA(g23:g30)-COUNTIF(g23:g30,0)+COUNTA(h5:h10)-COUNTIF(h5:h10,0) Squeaky "Rubber 4 u" wrote: > How do i w...

Cannot record macro in excel
If you cannot record macro in microsoft excel. I found one reason for that. Reason for this was security righs in registry. My case was this: We have Windows 2000 AD domain.We use compatws.inf template in group policy to give more rights to normal domain users. Situation was this: I cloned PC from image and in first boot i installed f-secure to PC. This installation added one registry key to hklm/software/classes/clsid and gave this key security righs to averyone . This key did not have permission to inherite permissions from upperlevel. Thats why security templates hangs and users did...

Specifying source campaign in Opp., not counting as campaign respo
General usage question regarding campaigns. If we create a campaign, then specify that campaign as the source campaign for an opportunity, that opportunity/account is not then listed as a response to that campaign. So when we run a Campaign Performance report, no responses are listed. Do you have to use the normal method of entering a response within the campaign? I'd think that if you can associate a campaign within the opportunity, that linkage would reflect in a Campaign Performance report. Thanks!! ...

How to count last name letters
Hi folks, I would like to know how I can count how many records have the same letter. For example, how many records start with the letter A, how many for letter B, etc. Seems simple enough, but I can't figure out how to work this. Would appreciate some help. Thanks. In news:uKD40b2rHHA.3484@TK2MSFTNGP05.phx.gbl, jason <jasonsantos-NOSPAM-@allstatesmedical.com> wrote: > Hi folks, > I would like to know how I can count how many records have the same > letter. For example, how many records start with the letter A, how > many for letter B, etc. > > Seems simple ...

A macro that copies entire worksheet to another
Hi- Can anybody help me with a macro that copies an entire worksheet to another (or creates a new worksheet named by a value in a cell)? I plan to use a push button to copy this data. I'd appreciate any help - Jim Ayers Hi Jim, Why don't you revert the easiest and the most illustrative method of writing a macro (and learning how to write a macro) by using the macro recording facility? There may be slight changes depending on your Excel version, but generally you click Tools --> Macro --> Record New Macro, then mimic exactly what you want to happen, stopping recording a...

Images and Excel Grids
Hi, I am creating a file from a web page with a .xls extension. The user wants an excel spreadsheet to contain product data, 1 item is an image. I want to have the image appear in the spreadsheet. I can have the image appear (i just use <img src="#ThisFileNameImageURLGif#" align="center" border="0" hspace="2">) and its inserted in the sheet. However I want it to stay within a cell and be lined up with headings and its own row of data. At the moment I get a load of images just "piling in" on top of each other How an i force the image to st...

Excel Personal settings/macros
I am using Excel 2003. I just ordered a new computer and would like to be able to transfer the file/s that contain my personal settings(toolbar set ups for example)/macros/whatever else to the new machine. Is this possible? What files do I need to copy and transfer and where do I find them. Please don't tell me I can't do this. <G> TIA Bill Saved from a previous post: I have a short list of things to copy/update when we change pc's at work. It's not complete, but may help you. Word/Excel files: FileName Use custom.dic personal dictionary *.acl p...

Count unique occurrences in a list
Hi guys, I have a list as so: Part1 Run1 Part1 Run1 Part2 Run1 Part3 Run1 Part4 Run2 Part4 Run2 Part1 Run3 Part2 Run3 Part5 Run3 Part6 Run4 Part1 Run5 Part1 Run5 Part1 Run5 Part6 Run5 .... Part1 Run1001 Part3 Run1001 Part3 Run1001 .... The number of unique parts may be >100 and the number of runs can be anything (it's actually ~2000 in my current list) What I would like to do is this: For each Part, count how many Runs contained that Part (that is the number of unique runs containing at least of that Part.) I should end up with a new list similar ...

Linked JPEG image
I have a form with a link to a JPEG image. How do I suppress the progress bar before the picture appears? This does not happen when it is linked to a BMP image. I prefer to link to JPEG because it is smaller and also is the same format as my digital camera.Any help would be grateful.Thanks Take a look at:http://www.mvps.org/access/api/api0038.htmKen SheridanStafford, England"Allen Yap" wrote:> I have a form with a link to a JPEG image. How do I suppress the progress bar > before the picture appears? This does not happen when it is linked to a BMP > image. I prefer to link to...

Count partial matched text string
I have 3 spreadsheets. The first, “Supplies Requests Received” where Column B contains the (duplicated) names of internal offices placing supply requests (e.g., SNF, DGEN, CANM, etc.) and Column G contains each date a request for supplies was received from that office. Column B Column B SNF 1//29/2009 DGEN 4/19/2008 CNMN 2/4/2009 ASEV 12/11/2008 SNF 2/3/2009 ASEV 9/16/2008 DGEN 5/1/2008 The second spreadsheet “Supplies Delivered” where Column A is a link of Column B from the above “Supplies Requests Received spreadsheet and Column G (of Supplies Delivered”) contains the names of ALL ...

macro
Hi, Need help on macro, pls. see if what I'm thinking is possible: I have 2 sheets in my file, the first sheet is where I input my data and I formatted sheet 2 for printing purposes. Let say I have these in sheet 1: Data 1 Date 2 Data 3 aaaa aaaaaa aaaaaaaaaaaaaa bbbb bbbbbb bbbbbbbbbbbbbb cccc cccccc cccccccccccccc Let say my cursor is on the first row of my data. I created a macro, with a corresponding shortcut key, so that the data on that row will be transferred to sheet 2 like: Data 1 aaa Date 2 aaaaaa Date 3 aaaaaaaaaaaaaa Now, I want to change the code (or mayb...

Counting with 2 criteria
I need to be able to pull counts from a frequently updated list based on associate's name and status of order. -- Amethyst =SUMPRODUCT(--(A1:A100="associate name"),--(B1:B100="status")) should do it for you, adjust the columns/rows to match your sheet. You could have a couple of cells to enter associate name/status into to make things easier; as associate name in C1 and status in D1: =SUMPRODUCT(--(A1:A100=C1),--(B1:B100=D1)) "Amethyst" wrote: > I need to be able to pull counts from a frequently updated list based on > associate&#...

Email signatures with images
Hello, Can anyone tell me the correct or recommended way to insert an image into an email signature ?, the most common way can see is to link to an image on a web server somewhere. You can also copy and paste into front page, where it some how encodes it into the HTML, but apparently this only works for Microsoft based email clients, and the image is of poor quality. I would be grateful for any suggestions Thanks Kind Regards -Neil Young ...

Macro to lock VBA project
Hello Is it possible to have a macro that will: 1. under VBA project properties lock project for viewing 2. open input box to input password to view project properties. 3. save file /or prompt to save as. So in other words after you open vba project and play woth macros, work on file etc, one could just click a button and a input box to input password to lock VBA project would be opened. Afeter you input it the input box closes and saves the file or prompts save as if it is not saved yet? I tried to google it and record it but no luck... Anyone? Thank you Excel's VBA doesn't supp...

Button not bring up Macro I created
I have created a Macro and a button that is suppose to link to the Macro. The button I created can't find the Macro. Does anyone know a good place to find a how to for this? Thanks Right click the button, on the dropdown click 'Assign Macro' The list of macro's will appear, assign the appropriate one to the button, Regards, Alan. "A.S." <A.S.@discussions.microsoft.com> wrote in message news:295A08DB-21DD-45D3-A610-525182AE40B8@microsoft.com... >I have created a Macro and a button that is suppose to link to the Macro. >The > button I created can...

using macro for sending multiple mail in outlook
Hello, I would like to send multiple mail separately whose context is the same but for different parameters. I can make by using macro. Thank you. See the CreateItem function in the VBA help file, which can be used to create a new email. For the email you can set properties like Subject, Body, Recipient etc. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: <http://www.vboffice.net/product.html?pub=6&lang=en> Am Fri, 18 Dec 2009 06:25:01 -0800 schrieb Hatice Başak YILDIROÖ: > Hello, > I would like to send mult...

Schedule a macro running
Is there anyway to schedule a spreadsheet to open and a macro containe within that spreadsheet to run, daily without user interaction. Hoping someone has a solution Okane -- okane ----------------------------------------------------------------------- okanem's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=930 View this thread: http://www.excelforum.com/showthread.php?threadid=38427 How about using the OS scheduler to run that file. -- HTH Bob Phillips "okanem" <okanem.1rn6ia_1120475101.094@excelforum-nospam.com> wrote in message news:oka...