Hi Bob,
Try this. I'm not sure it does exactly what your old macro did. If it
isn't right, let me know.
Sub ViewPage()
With ActiveWindow
If .View.Type = wdNormalView Then
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.View.Type = wdPrintView
End If
.ActivePane.View.Zoom.PageFit = wdPageFitFullPage
Else
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdNormalView
Else
.View.Type = wdNormalView
End If
.ActivePane.View.Zoom.PageFit = wdPageFitNone
End If
End With
End Sub
Wow Jay. That was very clear and helpful. I have now implemented all
the
things you gave me in this post and in the previous one. VERY helpful
indeed. I have cleared out a bunch of duplicates, have my macros in 3
small
modules that I have nemed with names that mean something to me rather
than
one confusingly named module, all in my global template. I feel they
are
now safer and less intertwined.
Can you help me with two other things? The first is probably really
simple.
The second may not be so simple.
1. My desktop machine was made by HP. Consequently, the default name
given
to all of my macros is "HP Authorized Customer". For some strange
reason,
I
would prefer my own name there.
Is there a way to change that
default
name?
2. I recently had to do a complete System Recovery of my computer,
which
included returning it to factory condition with a reinstall of Windows
XP
Pro (technically Windows Media Edition) and updates up through SP3 etc.
Before all of that I had a macro which I had assigned to a function key
which when I pressed the function key changed the appearance of the
page.
When I was in normal edit view it changed it to where I could see the
whole
page in a small font but could still edit the small print. If I was in
this
page view, it returned it to the larger print view that was easier to
see.
In the paragraph I used terribly untechnical language because I am
confused
as to why I do not still have that capability. This is what I know.
The
only macro I could find in my modules that seems to be addressing this
capacity is the ViewPage macro below. The other 2 very small macros I
have
recorded since my System Recovery to try to simulate this capacity with
two
macros.
With your vastly superior understanding of Visual Basic, could you tell
me
how to have this capacity within one macro?
Thank you so much. You are Sooooooooo patient.
Thanks again.
Bob
Sub ViewPage()
'
' ViewPage Macro
' Displays the page as it will be printed and allows editing
'
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
End Sub
Sub WholePagePrint()
'
' WholePagePrint Macro
' Macro recorded 9/2/2009 by Dr. Bob Singleton
'
ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitBestFit
Application.Run MacroName:="Normal.NewMacros.ViewPage"
End Sub
Sub Normal175()
'
' Normal175 Macro
' Macro recorded 9/2/2009 by Dr. Bob Singleton
'
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdNormalView
Else
ActiveWindow.View.Type = wdNormalView
End If
End Sub
Hi Bob,
No, that is not the way it's supposed to be. The Alt+F8 dialog shows
the
format "module.macro" only when macros with the same name exist in two
or
more templates. It sounds to me like you have the same set of macros
stored in two or three places.
Start by opening the global template by using the File > Open command
and
navigating to the Word\Startup folder -- you want it opened as if it
were
a document, not just loaded as a global template. Until it's opened
that
way, the macro editor won't let you look at its modules. Also open the
other template, or a document based on it.
Use the Project Explorer pane of the macro editor to look at the code
in
each of the modules in turn. If the same macros do exist in Normal and
in
one or both templates -- and if their code is identical -- then delete
them from all places except the global template. Yes, it's a good idea
to
keep important macros in global templates rather than in Normal.dot;
you
can still use Normal as a "scratch pad" for macros that you'll use a
few
times and then discard.
[An aside: Some people seem to corrupt Normal.dot frequently and often
have to delete it and start over. I don't know why that is, because in
15
years of constant use of Word I've only seen Normal.dot corrupted
once.
Still, once is enough...]
Be sure to save each template as you finish with it, and specifically
save
Normal.dot. Hint: Hold down the Shift key while clicking the File
menu,
and you'll find a Save All command that will include all open
documents
and templates, including Normal.dot.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup
so all may benefit.
Bob S wrote:
Thank you Jay. That was all helpful. But I am still a little not so
clear on my questions. Perhaps I should ask them this way. If I
open my global template, I see 3 lists of macros (one following the
other) in the window when I press Tools/Macros/Macros (Alt F8). All
3 lists have essentially the same 11 macros in them, just with a
different start to the name.
If I open a blank document, I see only two of these lists. But even
with two identical lists, it seems there may be unnecessary
duplication. Is this the way it is supposed to be? I was told when
I was getting started that it was good to keep your macros in a
global template so that when Normal.dot got corrupted and you had to
let Word start with an empty one, you would not have lost the macros
you had created or accumulated. Should I change anything? Thank you
for your help. Bob
Additional information:
"NewMacros" is the name of a module that's automatically used
(created if it doesn't exist) when you record a macro.
If instead you open the macro editor and use the Insert > Module
command, the default name of the module is "Module1" (and then
"Module2" and so on).
If you select any of these modules in the Project Explorer pane and
then open the Properties pane (View > Properties or F4), you can
rename the selected module to something that makes more sense to
you.
You can also create new empty modules and cut/paste macro code from
NewMacros into them, so you don't have 30 macros all stuffed into
one
bag. This can help immensely in finding code when you want it.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
Hi Bob,
The names that you cited probably refer to macros that are defined
in different templates. Press Alt+F11 to open the VB Editor. In the
Project Explorer pane, which you can switch to by pressing Ctrl+R,
expand the tree and look for the different NewMacros modules to see
what's in each one. --
Hope this helps,
Pesach Shelnitz
:
I use Word 2003 and am not sure whether this question belongs here
or in the
New Users group because it is very basic. I have about 30 macros
listed when I press Tools/Macros/Macros. The first group starts
"Normal.NewMacros...". The second group starts
"Project.NewMacros....". The third group starts
"TemplateProject.NewMacros....". It is my impression
that the first group are macros held in Normal.dot. The second
group are
held in my global.dot template. I have 4 questions.
1. Are my first two assumptions correct?
2. What is this third group of macros?
3. Are all 3 groups expected?
4. Is there something I should change?
Thank you for your help.
Bob