#1
|
||||
|
||||
Help with select all Shapes in headers
Hello pros,
I need your insights This is following a former thread of mine, regarding Shapes in headers. What I'm trying to do now is to select them all and convert them to inline shape. Cause at times, when I've converted a PDF to Word, it gives me a bunch of different types of Textboxes in headers and at times footers. I have a wonderful Script to extract the content of the Headers, however, if in other than Inline or if they are different, it or they get's deleted. So I loose my texts. My Test, in a Header, I've put a 7 Text box (1 under each other), for every Wrape Type there is. In this test, it's the only Header, so Primary. It might be different in live documents though. I found a script but modified it, cause I got an error message on the line of Convert to InlineShape. Maybe because a Shape was already Inline Shape, so the reason i've added, if wrapType is not inline, then convert to inline. Now I'm getting NO errors but it doesn't do anything Code:
Dim oSec As Section Dim oHftr As HeaderFooter Dim i As Integer Dim oShp As Shapes For Each oSec In ActiveDocument.Sections For Each oHftr In oSec.Headers If oHftr.Exists Then For i = oHftr.range.ShapeRange.Count To 1 Step -1 If oShpWrapType <> wdWrapMergeInline Then oHftr.range.ShapeRange.ConvertToInlineShape End If Next i End If Next oHftr Next oSec On Error GoTo 0 Am I asking the impossible you think? Any advice, or insights would be sooooo greatly be appreciated Cendrinne |
#2
|
||||
|
||||
There is no method to convert all shapes to inlineshapes in a single action. That said, try:
Code:
Sub Test() Application.ScreenUpdating = False Dim oSec As Section, oHftr As HeaderFooter, s As Long For Each oSec In ActiveDocument.Sections For Each oHftr In oSec.Headers With oHftr If .Exists Then On Error Resume Next For s = .Shapes.Count To 1 Step -1 .Shapes(s).ConvertToInlineShape Next On Error GoTo 0 End If End With Next Next Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Thank you, I got an error message...
Quote:
The code provided, thank you !!! However, it does gives me an error message. I'll try to translate, since my system is in French. Compilation Error. Method Member or data unfound. And it selected the word: ShapeRange Does that makes sense to you? Cendrinne |
#4
|
||||
|
||||
Ohhhh hooo, I've tried to fix it, by Trial and error and now my Word documents are frozen or continuing thinking.
I've changed: Do While oHftr.Shapes.Count > 0 oHftr.Shapes.range(1).ConvrtToInlineShape is that bad? Plus I don't have a Pause Break button. I found online how to activate On-Screen Keyboard by doing this: Hold Windows logo and press R. Type osk and press Enter to open On-Screen Keyboard. osk, Works I mean, but the Pause in it, didn't stop my running macro. I think I have to do Ctrl+Alt+Del then kill word, right? Cendrinne Update: Under this site What is the alternative to Pause and Break keys? - Appuals.com I've tried method 2, tried many things, but I'm not certain, I think Ctrl+Scroll Lock did the trick, or coincidence it worked right after. I have a modern keyboard, Logitech MK850, where Pause or Break, is not indicated on the keyboard. |
#5
|
||||
|
||||
My bad. That should have been a reference to Shapes. That said, the ConvertToInlineShape method doesn't work for all Shapes (i.e. some cannot be converted). Trying to do so results in a 4120 'Bad Parameter' error. See revised code.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
||||
|
||||
When it gets to that point, start the Task Manager, select the Word application and choose 'End Task'.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
||||
|
||||
Task Manager advice on running macro, never thought of that...
Quote:
OK wow, so cool, I'm learning so much from you Cendrinne |
#8
|
||||
|
||||
It is quite safe to do and won't reset Normal.dotm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
||||
|
||||
OH WOW, that works!!!!!!
OMG, you've done it. Genious!!!!!!! On my test document, where I've put different type of Wrap in the header, 6 out 7 is PERFECT! The only one it didnd't, but I rarely saw it modified from PDF to Word, and put header Textboxes with wrap Thight. I feel I owe you so much. So many of you on the forum, I owe so much. I do want one day, if possible to write a Technical book, but I need much much more skills and experience, and wanted to thank you and share the proceeds with the people who's helped me so much in my scripts. I won't forget about you Thank you from the bottom of my heart Cendrinne |
#10
|
||||
|
||||
Paul, since I've done Break or Pause, now my work keeps giving me that my Word is giving me a pop up message:
Interrupted Execution. What do I do to fix that? Any idea? Cendrinne |
#11
|
||||
|
||||
Oh hhooo can I fix that problem?
Paul, since I've done Break or Pause, now my work keeps giving me that my Word is giving me a pop up message:
Interrupted Execution. What do I do to fix that? Any idea? Cendrinne Update, I've tried everything I could think of. I've Rebooted, and so far so good So I'm ok so far Night |
#12
|
||||
|
||||
If you interrupt the execution of a macro (e.g. via Ctrl-Break), there's usually a message box allowing you to resume execution; otherwise you could switch to the VBE and press F5 - or choose Run>Reset to clear the existing macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
||||
|
||||
What?????? Not certain I understand
How do I switch to the VBE?
Cause since my Word is thinking, I can't do anything that has to do with Word. I might need extra explanation here. Cendrinne |
#14
|
||||
|
||||
You can access the VBE via Alt-F11. If Word has frozen, though, that might not be possible and might not help anyway. You may need to kill & restart Word via the Task Manager.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
||||
|
||||
I don't know if it's frozen, but I know it's thinking
I can see the wheel turning, and all Word documents are busy, so I can't do anything. I did the last time to stop Word with task manager. Thanks that was a great suggestions.
The only thing that bothers me doing that, is I have to Re open all my word documents. Normally I have a few open already. At least 3. But I guess if that is the easiest to do since my Word is thinking so much, it could take 30 min thinking. I think that is way too long. Right? Cendrinne |
Tags |
headers; help, textboxes |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Control A does not select some footers and some headers | Photon | Word | 5 | 04-20-2019 04:22 AM |
How to see what shapes have been used | ascheler | Visio | 1 | 07-08-2016 03:54 PM |
Headers - Find text, Select, Pass value to Varable | BrotherDude | Word VBA | 4 | 07-15-2015 05:42 PM |
Can't select shapes via macro | TishyMouse | Word VBA | 3 | 04-13-2012 03:26 AM |
My Shapes some appear some don't | Jean-Paul | Visio | 0 | 03-01-2006 01:38 AM |