This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
Public Sub ReplaceAllGraphicsWithNothing() Dim rngStory As Word.Range Dim lngJunk As Long Dim lngIndex As Long 'Fix the skipped blank Header/Footer problem lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType 'Iterate through all story types in the current document For Each rngStory In ActiveDocument.StoryRanges 'Iterate through all linked stories Do SrcAndRplInStory rngStory, "^g^p", "" SrcAndRplInStory rngStory, "^g^l", "" SrcAndRplInStory rngStory, "^g", "" For lngIndex = rngStory.ShapeRange.Count To 1 Step -1 rngStory.ShapeRange.Item(lngIndex).Delete Next lngIndex 'Get next linked story (if any) Set rngStory = rngStory.NextStoryRange Loop Until rngStory Is Nothing Next lbl_Exit: Exit Sub End Sub Public Sub SrcAndRplInStory(ByVal rngStory As Word.Range, _ ByVal strSearch As String, _ ByVal strReplace As String) With rngStory.Find .ClearFormatting .Replacement.ClearFormatting .Text = strSearch .Replacement.Text = strReplace .Execute Replace:=wdReplaceAll End With lbl_Exit: Exit Sub End Sub
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Stepan Konev Russian Federation Local time: 17:41 English to Russian
Macro uses ^g too
Jan 7, 2023
Hans Lenting wrote: The macro does work.
Weirdly it works for me... Probably it somehow relates to the format of images. However, as far as I can see now from the code, the macro uses exactly the same ^g. Right?
Update: Ah, ok, I have read the entire discussion. I see now. The macro also removes all floating images. When I prepare a file for translation, I make all images inline. That's is why simple replacement of ^g with a blank value works for me. However, if you have both inline and floating images, then the macro is a better choice indeed.
[Edited at 2023-01-07 06:19 GMT]
Hans Lenting
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Hans Lenting Netherlands Member (2006) German to Dutch
TOPIC STARTER
Yep
Jan 7, 2023
Stepan Konev wrote:
Hans Lenting wrote: The macro does work.
Weirdly it works for me... Probably it somehow related to the format of images. However, as far as I can see now from the code, the macro uses exactly the same ^g. Right?
Yes. But obviously, strange things DO happen.
Stepan Konev
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Manage your TMs and Terms ... and boost your translation business
Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.
Create customer quotes and invoices from within Trados Studio
Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.