From: andreas on 1 Dec 2009 05:29 Dear Experts: For some specific reason I inserted a frame into the current even page header. How can I delete it via VBA on the condition that the cursor resides in the page (of the main document) whose header has got this frame? Other headers, ie. odd page headers and first page header of the current section must not be deleted. Other headers in other sections may also have a frame in the header, but they must not be deleted, either. Help is much appreciated. Thank you very much in advance. Regards, Andreas
From: Pesach Shelnitz on 1 Dec 2009 06:27 Hi Andreas, The following macro will remove all frames from the header for even pages in the current section. (The current section is the section in which the cursor is located). Sub RemoveFrameFromCurrentEvenHeaderFooter() Dim i As Long Dim myRange As Range Set myRange = Selection.Sections(1).Headers(wdHeaderFooterEvenPages).Range With myRange For i = .Frames.Count To 1 Step -1 .Frames(i).Delete Next End With Set myRange = Nothing End Sub -- Hope this helps, Pesach Shelnitz My Web site: http://makeofficework.com "andreas" wrote: > Dear Experts: > > For some specific reason I inserted a frame into the current even page > header. How can I delete it via VBA on the condition that the cursor > resides in the page (of the main document) whose header has got this > frame? > > Other headers, ie. odd page headers and first page header of the > current section must not be deleted. > Other headers in other sections may also have a frame in the header, > but they must not be deleted, either. > > Help is much appreciated. Thank you very much in advance. > > Regards, Andreas > > . >
From: andreas on 1 Dec 2009 07:48 On Dec 1, 12:27 pm, Pesach Shelnitz <pesach18(AT)hotmail.com> wrote: > Hi Andreas, > > The following macro will remove all frames from the header for even pages in > the current section. (The current section is the section in which the cursor > is located). > > Sub RemoveFrameFromCurrentEvenHeaderFooter() > Dim i As Long > Dim myRange As Range > > Set myRange = Selection.Sections(1).Headers(wdHeaderFooterEvenPages).Range > With myRange > For i = .Frames.Count To 1 Step -1 > .Frames(i).Delete > Next > End With > > Set myRange = Nothing > End Sub > > -- > Hope this helps, > Pesach Shelnitz > My Web site:http://makeofficework.com > > > > "andreas" wrote: > > Dear Experts: > > > For some specific reason I inserted a frame into the current even page > > header. How can I delete it via VBA on the condition that the cursor > > resides in the page (of the main document) whose header has got this > > frame? > > > Other headers, ie. odd page headers and first page header of the > > current section must not be deleted. > > Other headers in other sections may also have a frame in the header, > > but they must not be deleted, either. > > > Help is much appreciated. Thank you very much in advance. > > > Regards, Andreas > > > .- Hide quoted text - > > - Show quoted text - Hi Pesach, great, it is working just fine. Thank you very much for your terrific help. There is one thing I would like to ask you: From the main document I am not able to see whether the current header where the frame is located is a "First Page Header", "EvenPageHeader" or a "PrimaryPageHeader". I would have to access the header to find out. Is it possible to rewrite the code so that REGARDLESS of the HEADER TYPE, the frame of the header of the current page is deleted? I hope I could make myself clear and it is not too demanding. Help is much appreciated. Thank you very much in advance. Regards, Andreas
From: Pesach Shelnitz on 1 Dec 2009 08:43 Hi Andreas, The macro in my previous post removes frames only from the even-page header in the current section and does not even look at the other headers. This is done by setting a Range object equal to the Range object of the even-page header. Of course, this code could be modified to do the same for all the headers in the current section, or even in all sections. It is also possible to add code that will pop up a message telling the user that a frame was found in header X and ask for confirmation before removing it. Would you like macros that do any of these things? -- Hope this helps, Pesach Shelnitz My Web site: http://makeofficework.com "andreas" wrote: > On Dec 1, 12:27 pm, Pesach Shelnitz <pesach18(AT)hotmail.com> wrote: > > Hi Andreas, > > > > The following macro will remove all frames from the header for even pages in > > the current section. (The current section is the section in which the cursor > > is located). > > > > Sub RemoveFrameFromCurrentEvenHeaderFooter() > > Dim i As Long > > Dim myRange As Range > > > > Set myRange = Selection.Sections(1).Headers(wdHeaderFooterEvenPages).Range > > With myRange > > For i = .Frames.Count To 1 Step -1 > > .Frames(i).Delete > > Next > > End With > > > > Set myRange = Nothing > > End Sub > > > > -- > > Hope this helps, > > Pesach Shelnitz > > My Web site:http://makeofficework.com > > > > > > > > "andreas" wrote: > > > Dear Experts: > > > > > For some specific reason I inserted a frame into the current even page > > > header. How can I delete it via VBA on the condition that the cursor > > > resides in the page (of the main document) whose header has got this > > > frame? > > > > > Other headers, ie. odd page headers and first page header of the > > > current section must not be deleted. > > > Other headers in other sections may also have a frame in the header, > > > but they must not be deleted, either. > > > > > Help is much appreciated. Thank you very much in advance. > > > > > Regards, Andreas > > > > > .- Hide quoted text - > > > > - Show quoted text - > > Hi Pesach, > > great, it is working just fine. Thank you very much for your terrific > help. > > There is one thing I would like to ask you: > > From the main document I am not able to see whether the current header > where the frame is located is a "First Page Header", "EvenPageHeader" > or a "PrimaryPageHeader". > I would have to access the header to find out. > > Is it possible to rewrite the code so that REGARDLESS of the HEADER > TYPE, the frame of the header of the current page is deleted? > > I hope I could make myself clear and it is not too demanding. > > Help is much appreciated. Thank you very much in advance. Regards, > Andreas > > . >
From: andreas on 1 Dec 2009 11:05 On Dec 1, 2:43 pm, Pesach Shelnitz <pesach18(AT)hotmail.com> wrote: > Hi Andreas, > > The macro in my previous post removes frames only from the even-page header > in the current section and does not even look at the other headers. This is > done by setting a Range object equal to the Range object of the even-page > header. Of course, this code could be modified to do the same for all the > headers in the current section, or even in all sections. It is also possible > to add code that will pop up a message telling the user that a frame was > found in header X and ask for confirmation before removing it. Would you like > macros that do any of these things? > > -- > Hope this helps, > Pesach Shelnitz > My Web site:http://makeofficework.com > > > > "andreas" wrote: > > On Dec 1, 12:27 pm, Pesach Shelnitz <pesach18(AT)hotmail.com> wrote: > > > Hi Andreas, > > > > The following macro will remove all frames from the header for even pages in > > > the current section. (The current section is the section in which the cursor > > > is located). > > > > Sub RemoveFrameFromCurrentEvenHeaderFooter() > > > Dim i As Long > > > Dim myRange As Range > > > > Set myRange = Selection.Sections(1).Headers(wdHeaderFooterEvenPages).Range > > > With myRange > > > For i = .Frames.Count To 1 Step -1 > > > .Frames(i).Delete > > > Next > > > End With > > > > Set myRange = Nothing > > > End Sub > > > > -- > > > Hope this helps, > > > Pesach Shelnitz > > > My Web site:http://makeofficework.com > > > > "andreas" wrote: > > > > Dear Experts: > > > > > For some specific reason I inserted a frame into the current even page > > > > header. How can I delete it via VBA on the condition that the cursor > > > > resides in the page (of the main document) whose header has got this > > > > frame? > > > > > Other headers, ie. odd page headers and first page header of the > > > > current section must not be deleted. > > > > Other headers in other sections may also have a frame in the header, > > > > but they must not be deleted, either. > > > > > Help is much appreciated. Thank you very much in advance. > > > > > Regards, Andreas > > > > > .- Hide quoted text - > > > > - Show quoted text - > > > Hi Pesach, > > > great, it is working just fine. Thank you very much for your terrific > > help. > > > There is one thing I would like to ask you: > > > From the main document I am not able to see whether the current header > > where the frame is located is a "First Page Header", "EvenPageHeader" > > or a "PrimaryPageHeader". > > I would have to access the header to find out. > > > Is it possible to rewrite the code so that REGARDLESS of the HEADER > > TYPE, the frame of the header of the current page is deleted? > > > I hope I could make myself clear and it is not too demanding. > > > Help is much appreciated. Thank you very much in advance. Regards, > > Andreas > > > .- Hide quoted text - > > - Show quoted text - Dear Pesach, thank you very much for your superb help. Actually there is one thing that would suffice: Macro code to tell me which is the current header (on the condition that my cursor is located in the main document and I select "View - Header-Footers" from the Main Menu): For example: the code should tell me that "... the current header is located on section x, adjusted page number x and is a primary or even or first page header". I hope this is not beyond the scope of this forum. Thank you very much in advance. Regards, Andreas
|
Next
|
Last
Pages: 1 2 Prev: Create INI file; save to user selected location Next: Problem with Word 2007 |