Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Adding Macros to Toolbar
I have managed to create a footer for the insertion of filename and path in Word 2007 documents. This appears in the Footer Gallery and works well on any saved document if I go to Insert, Footer and then scroll down to select my footer. This is a bit tedious so I have been trying to record a macro for this and put it on the Quick Access Toolbar. The macro records without problem and I assign it to a button on the qat as instructed. However, when I try to run it on any document I get a runtime error 5941 notifying 'the requested member of the collection does not exist'. I am stumped over this and wonder if anyone else has tried this. I have other macros which I used to use with Word 2000 and will recreate these, but I do need a one button access for them, not a hunt through menus.
|
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Adding Macros to Toolbar
It is not the adding of the macro to the QAT that's the problem but that the
macro recorder makes a dog's breakfast of recording matters relating to building blocks. However, there can be any number of footers in a document. The following macro will insert the filename and path in all the footers of a document after any existing footer. Sub InsertPathInFooters() Dim iSec As Integer Dim oFooter As HeaderFooter Dim oSection As Section Dim rFooter As Range With ActiveDocument If Len(.Path) = 0 Then .Save For Each oSection In ActiveDocument.Sections For Each oFooter In oSection.Footers Set rFooter = oFooter.Range rFooter.InsertAfter vbCr & .FullName With rFooter.Paragraphs(rFooter.Paragraphs.Count) .Alignment = wdAlignParagraphRight With .Range .Font.name = "Arial" .Font.Size = 8 End With End With Next oFooter Next oSection End With End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org jokelly27 wrote: I have managed to create a footer for the insertion of filename and path in Word 2007 documents. This appears in the Footer Gallery and works well on any saved document if I go to Insert, Footer and then scroll down to select my footer. This is a bit tedious so I have been trying to record a macro for this and put it on the Quick Access Toolbar. The macro records without problem and I assign it to a button on the qat as instructed. However, when I try to run it on any document I get a runtime error 5941 notifying 'the requested member of the collection does not exist'. I am stumped over this and wonder if anyone else has tried this. I have other macros which I used to use with Word 2000 and will recreate these, but I do need a one button access for them, not a hunt through menus. |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Adding Macros to Toolbar
Another option is to add the path and filename to your template, so it
will be there automatically. On Sep 24, 4:22*am, jokelly27 wrote: I have managed to create a footer for the insertion of filename and path in Word 2007 documents. This appears in the Footer Gallery and works well on any saved document if I go to Insert, Footer and then scroll down to select my footer. This is a bit tedious so I have been trying to record a macro for this and put it on the Quick Access Toolbar. The macro records without problem and I assign it to a button on the qat as instructed. However, when I try to run it on any document I get a runtime error 5941 notifying 'the requested member of the collection does not exist'. I am stumped over this and wonder if anyone else has tried this. I have other macros which I used to use with Word 2000 and will recreate these, but I do need a one button access for them, not a hunt through menus. -- jokelly27 |
#4
|
|||
|
|||
[quote=Graham Mayor;436086]It is not the adding of the macro to the QAT that's the problem but that the
macro recorder makes a dog's breakfast of recording matters relating to building blocks. However, there can be any number of footers in a document. The following macro will insert the filename and path in all the footers of a document after any existing footer. Sub InsertPathInFooters() Dim iSec As Integer Dim oFooter As HeaderFooter Dim oSection As Section Dim rFooter As Range With ActiveDocument If Len(.Path) = 0 Then .Save For Each oSection In ActiveDocument.Sections For Each oFooter In oSection.Footers Set rFooter = oFooter.Range rFooter.InsertAfter vbCr & .FullName With rFooter.Paragraphs(rFooter.Paragraphs.Count) .Alignment = wdAlignParagraphRight With .Range .Font.name = "Arial" .Font.Size = 8 End With End With Next oFooter Next oSection End With End Sub -- Graham Mayor - Word MVP Thank you for the macro. I have to confess I don't know what to do with your blueprint above. How can I copy this or do I have to go through the commands? I have seen other macros written like this on forums, but it is time I learned what you do with them. I am about intermediate but haven't done much beyond uncomplicated addition of a few macro buttons in Word 2000 - how can this version 2007 be an improvement? I am finding it non-intuitive and have downloaded the interactive old 2000 version which does help somewhat. |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Adding Macros to Toolbar
See http://www.gmayor.com/installing_macro.htm
-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "jokelly27" wrote in message ... Graham Mayor;436086 Wrote: It is not the adding of the macro to the QAT that's the problem but that the macro recorder makes a dog's breakfast of recording matters relating to building blocks. However, there can be any number of footers in a document. The following macro will insert the filename and path in all the footers of a document after any existing footer. Sub InsertPathInFooters() Dim iSec As Integer Dim oFooter As HeaderFooter Dim oSection As Section Dim rFooter As Range With ActiveDocument If Len(.Path) = 0 Then .Save For Each oSection In ActiveDocument.Sections For Each oFooter In oSection.Footers Set rFooter = oFooter.Range rFooter.InsertAfter vbCr & .FullName With rFooter.Paragraphs(rFooter.Paragraphs.Count) .Alignment = wdAlignParagraphRight With .Range .Font.name = "Arial" .Font.Size = 8 End With End With Next oFooter Next oSection End With End Sub -- Graham Mayor - Word MVP Thank you for the macro. I have to confess I don't know what to do with your blueprint above. How can I copy this or do I have to go through the commands? I have seen other macros written like this on forums, but it is time I learned what you do with them. I am about intermediate but haven't done much beyond uncomplicated addition of a few macro buttons in Word 2000 - how can this version 2007 be an improvement? I am finding it non-intuitive and have downloaded the interactive old 2000 version which does help somewhat. -- jokelly27 |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Adding Macros to Toolbar
See http://www.gmayor.com/installing_macro.htm
which will work for Word 2000 or 2007. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org jokelly27 wrote: Graham Mayor;436086 Wrote: It is not the adding of the macro to the QAT that's the problem but that the macro recorder makes a dog's breakfast of recording matters relating to building blocks. However, there can be any number of footers in a document. The following macro will insert the filename and path in all the footers of a document after any existing footer. Sub InsertPathInFooters() Dim iSec As Integer Dim oFooter As HeaderFooter Dim oSection As Section Dim rFooter As Range With ActiveDocument If Len(.Path) = 0 Then .Save For Each oSection In ActiveDocument.Sections For Each oFooter In oSection.Footers Set rFooter = oFooter.Range rFooter.InsertAfter vbCr & .FullName With rFooter.Paragraphs(rFooter.Paragraphs.Count) .Alignment = wdAlignParagraphRight With .Range .Font.name = "Arial" .Font.Size = 8 End With End With Next oFooter Next oSection End With End Sub -- Graham Mayor - Word MVP Thank you for the macro. I have to confess I don't know what to do with your blueprint above. How can I copy this or do I have to go through the commands? I have seen other macros written like this on forums, but it is time I learned what you do with them. I am about intermediate but haven't done much beyond uncomplicated addition of a few macro buttons in Word 2000 - how can this version 2007 be an improvement? I am finding it non-intuitive and have downloaded the interactive old 2000 version which does help somewhat. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating Macros and adding to group menu on toolbar | New Users | |||
adding macros to a template | Microsoft Word Help | |||
Adding macros to new menu | Formatting Long Documents | |||
adding a toolbar | Microsoft Word Help | |||
macros on toolbar | Microsoft Word Help |