Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
I'm trying to record a macro that will number the pages in my document. I
seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Tools, Macros, select and Delete.
-- Terry Farrell - MSWord MVP "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Note that this should not require a macro. Just View | Header and Footer,
Switch Between Header and Footer, Ctrl+E to center (or tab once to the centered tab stop), click on Insert Page Number, and all your pages will be numbered. Save the document as a template if desired. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet |
#4
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Thanks Terry and Suzanne,
I should say that I use MS Word 2007, so I don't have the Tools etc. pathway to go. I found the dialogue that allowed me to erase previous attempts at making macros, so that's good. Suzanne, to be clear, I use the standard way of doing page numbers that involves clicking on the Insert tab, then page numbering, then waiting while the options load, then selecting bottom center, my consistent choice. I just want to automate the process, so while your suggestion makes sense it doesn't really save me the clicks. OTOH, the notion of creating a template makes sense. However, I'd still like to find out why I'm having trouble recording this simple macro, since I'd probably make some other ones to automate certain common tasks. That's the reason for macros, right? So if someone still might help me figure out what's going wrong with my current attempt I'd be very grateful. Barnet |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
In Word 2007, the Macro button is on the Developer tab on the Ribbon. But
you need to enable the Developer Tab under Word Options, Popular Tab. Terry "Barnet" wrote in message ... Thanks Terry and Suzanne, I should say that I use MS Word 2007, so I don't have the Tools etc. pathway to go. I found the dialogue that allowed me to erase previous attempts at making macros, so that's good. Suzanne, to be clear, I use the standard way of doing page numbers that involves clicking on the Insert tab, then page numbering, then waiting while the options load, then selecting bottom center, my consistent choice. I just want to automate the process, so while your suggestion makes sense it doesn't really save me the clicks. OTOH, the notion of creating a template makes sense. However, I'd still like to find out why I'm having trouble recording this simple macro, since I'd probably make some other ones to automate certain common tasks. That's the reason for macros, right? So if someone still might help me figure out what's going wrong with my current attempt I'd be very grateful. Barnet |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
"Barnet" wrote in message
... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#7
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Hi John,
Thanks so much, we're getting close. Let me show you what the debug window displays: WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _ Whe=Selection.Range, RichText:=True WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Plain Number 2"). _ Insert Whe=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub Now, I know absolutely zippo about Visual Basic. I have noticed that it seems to want to put "Plain Number 2" in, whereas I'd think it would want to insert the symbol for successive page numbers (whatever that would be). I have tried to create this macro both by going straight to the page number tab, and also by first opening a footer, selecting "blank", and then using the page number tab. I then have to use the Exit Footer (or whatever it's called) button to get back to the main document. But no matter what I try it ends up with the error messages above. Thanks for taking the time with my question, I appreciate it. Barnet "John... Visio MVP" wrote: "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#8
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
I am not sure what is going on but
Debug.Print ActiveDocument.AttachedTemplate.BuildingBlockEntri es.Count results in a value of zero. From another thread, it appears, according to Graham Mayor, the macro recorder makes a mess of Autotext entries :Word 2007 stores autotext entries differently from earlier versions and the :macro recorder does not record entries that are stored in :buildingblocks.dotx. In fact the macro recorder makes a complete hash of :recording anything to do with autotext entries. You will have to modify the :code by hand : :If your macro crashes on the line : :ActiveDocument.AttachedTemplate.BuildingBlockEntr ies("Plain Number 1"). _ :Insert Whe=Selection.Range, RichText:=True : then the entry is not stored in the document template where the line is :looking for it. : :Either use the BuildingBlocks Organizer to move it to the document template r :to normal.dot and then use : :NormalTemplate.BuildingBlockEntries("Plain Number 1").Insert :Whe=Selection.Range, _ :RichText:=True Unfortunately, I have been unable to get the NormalTemplate to work. I still end up with a count of zero. John... Visio MVP "Barnet" wrote in message ... Hi John, Thanks so much, we're getting close. Let me show you what the debug window displays: WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _ Whe=Selection.Range, RichText:=True WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Plain Number 2"). _ Insert Whe=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub Now, I know absolutely zippo about Visual Basic. I have noticed that it seems to want to put "Plain Number 2" in, whereas I'd think it would want to insert the symbol for successive page numbers (whatever that would be). I have tried to create this macro both by going straight to the page number tab, and also by first opening a footer, selecting "blank", and then using the page number tab. I then have to use the Exit Footer (or whatever it's called) button to get back to the main document. But no matter what I try it ends up with the error messages above. Thanks for taking the time with my question, I appreciate it. Barnet "John... Visio MVP" wrote: "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#9
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Hi John,
To the extent I understand your post, it seems as if I'm stuck. The somewhat odd thing is that the macro recorder seems to reach for AutoText or BuildingBlocks, if that's similar. Is that where the page numbers used by the Insert Page Number tab live? Anyway, I guess that's the end of the road on this one. Seems very strange that something seemingly so simple crashes. Thanks again, Barnet "John... Visio MVP" wrote: I am not sure what is going on but Debug.Print ActiveDocument.AttachedTemplate.BuildingBlockEntri es.Count results in a value of zero. From another thread, it appears, according to Graham Mayor, the macro recorder makes a mess of Autotext entries :Word 2007 stores autotext entries differently from earlier versions and the :macro recorder does not record entries that are stored in :buildingblocks.dotx. In fact the macro recorder makes a complete hash of :recording anything to do with autotext entries. You will have to modify the :code by hand : :If your macro crashes on the line : :ActiveDocument.AttachedTemplate.BuildingBlockEntr ies("Plain Number 1"). _ :Insert Whe=Selection.Range, RichText:=True : then the entry is not stored in the document template where the line is :looking for it. : :Either use the BuildingBlocks Organizer to move it to the document template r :to normal.dot and then use : :NormalTemplate.BuildingBlockEntries("Plain Number 1").Insert :Whe=Selection.Range, _ :RichText:=True Unfortunately, I have been unable to get the NormalTemplate to work. I still end up with a count of zero. John... Visio MVP "Barnet" wrote in message ... Hi John, Thanks so much, we're getting close. Let me show you what the debug window displays: WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _ Whe=Selection.Range, RichText:=True WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Plain Number 2"). _ Insert Whe=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub Now, I know absolutely zippo about Visual Basic. I have noticed that it seems to want to put "Plain Number 2" in, whereas I'd think it would want to insert the symbol for successive page numbers (whatever that would be). I have tried to create this macro both by going straight to the page number tab, and also by first opening a footer, selecting "blank", and then using the page number tab. I then have to use the Exit Footer (or whatever it's called) button to get back to the main document. But no matter what I try it ends up with the error messages above. Thanks for taking the time with my question, I appreciate it. Barnet "John... Visio MVP" wrote: "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#10
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
It is possible, but I think someone like Graham Mayor or Greg Maxek know the
workaround. John.. "Barnet" wrote in message ... Hi John, To the extent I understand your post, it seems as if I'm stuck. The somewhat odd thing is that the macro recorder seems to reach for AutoText or BuildingBlocks, if that's similar. Is that where the page numbers used by the Insert Page Number tab live? Anyway, I guess that's the end of the road on this one. Seems very strange that something seemingly so simple crashes. Thanks again, Barnet "John... Visio MVP" wrote: I am not sure what is going on but Debug.Print ActiveDocument.AttachedTemplate.BuildingBlockEntri es.Count results in a value of zero. From another thread, it appears, according to Graham Mayor, the macro recorder makes a mess of Autotext entries :Word 2007 stores autotext entries differently from earlier versions and the :macro recorder does not record entries that are stored in :buildingblocks.dotx. In fact the macro recorder makes a complete hash of :recording anything to do with autotext entries. You will have to modify the :code by hand : :If your macro crashes on the line : :ActiveDocument.AttachedTemplate.BuildingBlockEntr ies("Plain Number 1"). _ :Insert Whe=Selection.Range, RichText:=True : then the entry is not stored in the document template where the line is :looking for it. : :Either use the BuildingBlocks Organizer to move it to the document template r :to normal.dot and then use : :NormalTemplate.BuildingBlockEntries("Plain Number 1").Insert :Whe=Selection.Range, _ :RichText:=True Unfortunately, I have been unable to get the NormalTemplate to work. I still end up with a count of zero. John... Visio MVP "Barnet" wrote in message ... Hi John, Thanks so much, we're getting close. Let me show you what the debug window displays: WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _ Whe=Selection.Range, RichText:=True WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Plain Number 2"). _ Insert Whe=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub Now, I know absolutely zippo about Visual Basic. I have noticed that it seems to want to put "Plain Number 2" in, whereas I'd think it would want to insert the symbol for successive page numbers (whatever that would be). I have tried to create this macro both by going straight to the page number tab, and also by first opening a footer, selecting "blank", and then using the page number tab. I then have to use the Exit Footer (or whatever it's called) button to get back to the main document. But no matter what I try it ends up with the error messages above. Thanks for taking the time with my question, I appreciate it. Barnet "John... Visio MVP" wrote: "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#11
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Use:
Dim prange As Range With ActiveDocument Set prange = .Sections(1).Footers(wdHeaderFooterPrimary).Range .Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="page" prange.ParagraphFormat.Alignment = wdAlignParagraphCenter End With If you want the page number on the right, replace wdAlignParagraphCenter with wdAlignParagraphRight, similarly for left. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... Hi John, To the extent I understand your post, it seems as if I'm stuck. The somewhat odd thing is that the macro recorder seems to reach for AutoText or BuildingBlocks, if that's similar. Is that where the page numbers used by the Insert Page Number tab live? Anyway, I guess that's the end of the road on this one. Seems very strange that something seemingly so simple crashes. Thanks again, Barnet "John... Visio MVP" wrote: I am not sure what is going on but Debug.Print ActiveDocument.AttachedTemplate.BuildingBlockEntri es.Count results in a value of zero. From another thread, it appears, according to Graham Mayor, the macro recorder makes a mess of Autotext entries :Word 2007 stores autotext entries differently from earlier versions and the :macro recorder does not record entries that are stored in :buildingblocks.dotx. In fact the macro recorder makes a complete hash of :recording anything to do with autotext entries. You will have to modify the :code by hand : :If your macro crashes on the line : :ActiveDocument.AttachedTemplate.BuildingBlockEntr ies("Plain Number 1"). _ :Insert Whe=Selection.Range, RichText:=True : then the entry is not stored in the document template where the line is :looking for it. : :Either use the BuildingBlocks Organizer to move it to the document template r :to normal.dot and then use : :NormalTemplate.BuildingBlockEntries("Plain Number 1").Insert :Whe=Selection.Range, _ :RichText:=True Unfortunately, I have been unable to get the NormalTemplate to work. I still end up with a count of zero. John... Visio MVP "Barnet" wrote in message ... Hi John, Thanks so much, we're getting close. Let me show you what the debug window displays: WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _ Whe=Selection.Range, RichText:=True WordBasic.ViewFooterOnly ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Plain Number 2"). _ Insert Whe=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub Now, I know absolutely zippo about Visual Basic. I have noticed that it seems to want to put "Plain Number 2" in, whereas I'd think it would want to insert the symbol for successive page numbers (whatever that would be). I have tried to create this macro both by going straight to the page number tab, and also by first opening a footer, selecting "blank", and then using the page number tab. I then have to use the Exit Footer (or whatever it's called) button to get back to the main document. But no matter what I try it ends up with the error messages above. Thanks for taking the time with my question, I appreciate it. Barnet "John... Visio MVP" wrote: "Barnet" wrote in message ... I'm trying to record a macro that will number the pages in my document. I seem to do OK at first: name the macro, make a keyboard shortcut, begin recording, execute the commands to put page numbers at the bottom center of the document, and then stop recording. But when I run the macro it stops with 'Runtime error 5941, the requested member of the collection does not exist.' When I look at debug, it seems to show all the steps except for adding the page number itself down in the footer. Also, since I've tried this a few times I seem to have to come up with new names for the macro. Is there a way to erase all the old attempts and old names to 'clear the slate'? Thanks in advance, Barnet Your error was due to a line like ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Pg. Number 1").Insert Whe=Selection.Range, RichText:=True I am not sure why, but it may be a matter of context. You should be aware, that what the macro recorder records is not always great code and there may be issues with replaying the macros. With the Headers/Footers you need to switch windows between the main window and the H/F window and that may be an issue. John... Visio MVP |
#12
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Are they people I can get in touch within some way? Or might they read this
here in the forum? Or can you ask them about this? Barnet "John... Visio MVP" wrote: It is possible, but I think someone like Graham Mayor or Greg Maxek know the workaround. John.. |
#13
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
"Barnet" wrote in message
news Are they people I can get in touch within some way? Or might they read this here in the forum? Or can you ask them about this? Barnet "John... Visio MVP" wrote: It is possible, but I think someone like Graham Mayor or Greg Maxek know the workaround. John.. They usually read the newsgroup, so I was hoping one of them (or any of the other experts here) would see the bat signal and reply. It seems Doug has risen to the challenge with an answer. And before I get in trouble, it is Greg Maxey not Greg Maxek. Sorry about that Greg. John.. Visio MVP |
#14
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
"Doug Robbins - Word MVP" wrote in message
... Hope this helps. Doug Robbins - Word MVP Thanks Doug for stepping in. John... Visio MVP |
#15
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
"Doug Robbins - Word MVP" wrote in message ... Hope this helps. Doug Robbins - Word MVP ???????? Barnet Thanks Doug for stepping in. John... Visio MVP |
#16
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
I am not sure what you mean by
???????? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... "Doug Robbins - Word MVP" wrote in message ... Hope this helps. Doug Robbins - Word MVP ???????? Barnet Thanks Doug for stepping in. John... Visio MVP |
#17
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
On Feb 19, 5:26*pm, "John... Visio MVP"
wrote: "Barnet" wrote in message news Are they people I can get in touch within some way? Or might they read this here in the forum? Or can you ask them about this? Barnet "John... Visio MVP" wrote: It is possible, but I think someone like Graham Mayor or Greg Maxek know the workaround. John.. They usually read the newsgroup, so I was hoping one of them *(or any of the other experts here) would see the bat signal and reply. It seems Doug has risen to the challenge with an answer. And before I get in trouble, it is Greg Maxey not Greg Maxek. Sorry about that Greg. John.. Visio MVP John, If I was upset my spelling errors then I would always be upset with myself. No problem. I haven't followed all of this thread, so what I am posting may have already been addressed of of no value. While it can often be a good place to start, the recorder can also make a dog's breakfast out of any attempt to create macro. This is a case in point. The problem is that the builidngblocks in question are not part of the attached template but a one of the predefined building blocks that ships with Word and stored in the Bluilding Blocks.dotx file. Worse yet, this collection isn't available if Building Blocks.dotx isn't loaded. Writing from scratch you could use the following, but I believe that Doug's suggestion is better. Sub ScratchMacro() Dim oTmp As Template Templates.LoadBuildingBlocks For Each oTmp In Templates If oTmp.Name = "Building Blocks.dotx" Then Exit For Next oTmp oTmp.BuildingBlockEntries(" Blank").Insert Selection.Range 'Or 'oTmp.BuildingBlockTypes(wdTypeFooters).Categories ("Built- In").BuildingBlocks(" Blank").Insert Selection.Range oTmp.BuildingBlockEntries("Plain Number 2").Insert Selection.Range End Sub |
#18
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
I think I threw him off be servely trimming your post so I could say thank
you. John... Visio MVP "Doug Robbins - Word MVP" wrote in message ... I am not sure what you mean by ???????? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... "Doug Robbins - Word MVP" wrote in message ... Hope this helps. Doug Robbins - Word MVP ???????? Barnet Thanks Doug for stepping in. John... Visio MVP |
#19
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Yes, that is probably what it was. I wonder if he found my original post?
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "John... Visio MVP" wrote in message ... I think I threw him off be servely trimming your post so I could say thank you. John... Visio MVP "Doug Robbins - Word MVP" wrote in message ... I am not sure what you mean by ???????? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... "Doug Robbins - Word MVP" wrote in message ... Hope this helps. Doug Robbins - Word MVP ???????? Barnet Thanks Doug for stepping in. John... Visio MVP |
#20
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Hi Doug,
Thanks for your time. From what I can tell, the other posters believe you've come up with an answer to the question. However, this being a newbie forum, and I myself being a newbie... ....well, I am utterly lost by the answer you've provided! I tried Developer Tab -- Macros -- Edit and then pasted the code in the box that came up. But nothing seemed to happen when I tried the shortcut keys. Would you be kind enough to help me understand your answer, and how to execute it? Thanks very much, Barnet "Doug Robbins - Word MVP" wrote: Use: Dim prange As Range With ActiveDocument Set prange = .Sections(1).Footers(wdHeaderFooterPrimary).Range .Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="page" prange.ParagraphFormat.Alignment = wdAlignParagraphCenter End With If you want the page number on the right, replace wdAlignParagraphCenter with wdAlignParagraphRight, similarly for left. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP |
#21
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Doug wrote:
Use: Dim prange As Range With ActiveDocument Set prange = .Sections(1).Footers(wdHeaderFooterPrimary).Range ..Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="page" prange.ParagraphFormat.Alignment = wdAlignParagraphCenter End With If you want the page number on the right, replace wdAlignParagraphCenter with wdAlignParagraphRight, similarly for left. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP Thanks so much Doug, I appreciate your efforts. Being completely unfamiliar with Visual Basic, I need some more assistance in knowing what to do with this code. I can find the box to edit Macros. However, simply pasting in the code doesn't seem to make anything happen when I then try to run the Macro Would you be kind enough to tell me what to do with your code so that I can make the macro work? I assume that this post is to the newsgroup, so I hope it's OK that I ask you here. Thanks, Barnet |
#22
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Ooops, sorry for the double post. I actually didn't see the Next page tab at
the bottom and so I thought the first one didn't go through. Barnet |
#23
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Yes, this is the place to ask for assistance.
See the following articles: "What do I do with macros sent to me by other newsgroup readers to help me out?" at: http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm "How to assign a Word command or macro to a hot-key" at: http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm "How to assign a Word command or macro to a toolbar or menu" at: http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... Doug wrote: Use: Dim prange As Range With ActiveDocument Set prange = .Sections(1).Footers(wdHeaderFooterPrimary).Range .Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="page" prange.ParagraphFormat.Alignment = wdAlignParagraphCenter End With If you want the page number on the right, replace wdAlignParagraphCenter with wdAlignParagraphRight, similarly for left. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP Thanks so much Doug, I appreciate your efforts. Being completely unfamiliar with Visual Basic, I need some more assistance in knowing what to do with this code. I can find the box to edit Macros. However, simply pasting in the code doesn't seem to make anything happen when I then try to run the Macro Would you be kind enough to tell me what to do with your code so that I can make the macro work? I assume that this post is to the newsgroup, so I hope it's OK that I ask you here. Thanks, Barnet |
#24
Posted to microsoft.public.word.newusers
|
|||
|
|||
Newbie macro help please
Hi Doug,
Thanks so much, this did the trick! I really appreciate your efforts on my behalf. Barnet "Doug Robbins - Word MVP" wrote: Yes, this is the place to ask for assistance. See the following articles: "What do I do with macros sent to me by other newsgroup readers to help me out?" at: http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm "How to assign a Word command or macro to a hot-key" at: http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm "How to assign a Word command or macro to a toolbar or menu" at: http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Barnet" wrote in message ... Doug wrote: Use: Dim prange As Range With ActiveDocument Set prange = .Sections(1).Footers(wdHeaderFooterPrimary).Range .Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="page" prange.ParagraphFormat.Alignment = wdAlignParagraphCenter End With If you want the page number on the right, replace wdAlignParagraphCenter with wdAlignParagraphRight, similarly for left. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP Thanks so much Doug, I appreciate your efforts. Being completely unfamiliar with Visual Basic, I need some more assistance in knowing what to do with this code. I can find the box to edit Macros. However, simply pasting in the code doesn't seem to make anything happen when I then try to run the Macro Would you be kind enough to tell me what to do with your code so that I can make the macro work? I assume that this post is to the newsgroup, so I hope it's OK that I ask you here. Thanks, Barnet |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Newbie question - how can I run a macro on a protected document | New Users | |||
[newbie] better vba coding | Microsoft Word Help | |||
NewBie Question 2 Please Help | New Users | |||
Newbie to Word Please help | New Users | |||
Newbie can't get MM to work | Mailmerge |