A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding Macros to Toolbar



 
 
Thread Tools Display Modes
  #1  
Old September 24th, 2009, 09:22 AM posted to microsoft.public.word.newusers
jokelly27[_2_]
external usenet poster
 
Posts: 1
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.




--
jokelly27
  #2  
Old September 24th, 2009, 03:08 PM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
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  
Old September 24th, 2009, 03:40 PM posted to microsoft.public.word.newusers
Amish
external usenet poster
 
Posts: 52
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  
Old September 25th, 2009, 10:34 AM posted to microsoft.public.word.newusers
jokelly27[_3_]
external usenet poster
 
Posts: 1
Default Adding Macros to Toolbar


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
  #5  
Old September 25th, 2009, 02:57 PM posted to microsoft.public.word.newusers
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
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  
Old September 25th, 2009, 02:58 PM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
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.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.