Reply
 
Thread Tools Display Modes
  #1   Report Post  
jokelly27 jokelly27 is offline
Junior Member
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Amish Amish is offline
external usenet poster
 
Posts: 35
Default 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   Report Post  
jokelly27 jokelly27 is offline
Junior Member
 
Posts: 3
Default

[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   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Macros and adding to group menu on toolbar Phildunc New Users 2 December 10th 07 07:43 PM
adding macros to a template Rama Microsoft Word Help 1 June 20th 07 04:25 PM
Adding macros to new menu Jacqui Formatting Long Documents 4 November 10th 06 04:51 PM
adding a toolbar Chris Microsoft Word Help 3 November 2nd 06 12:29 PM
macros on toolbar [email protected] Microsoft Word Help 2 March 22nd 05 04:44 PM


All times are GMT +1. The time now is 12:46 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"