Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2021, 07:40 AM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default VBA project unviewable and problems with macros and shortcuts in templates

I've gotten into a bit of a mess with templates and macros. In trying to save a document in which I'd sorted out the Styles gallery as the Normal template by renaming the existing Normal template, etc., I found that templates I was saving did not neccessarily include keyboard shortcuts for my macros or even the macros themselves (at least not visibly). But some of the keyboard shortcuts still work (others don't).



I now cannot access VBA in any template - the project is unviewable and the Help message I get is 'Your organization's administrator turned off the service required to use this feature'. I've checked the Startup menu and can't see any Word templates there, and I am the administrator on my PC.

I am cross-posting with other forums, as I need to get this solved asap.
Reply With Quote
  #2  
Old 11-11-2021, 10:39 AM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

You CANNOT save a document or another template as the Normal Template and have a fully-functional normal template. I think you have discovered that.

See if you can recover your old normal template. There may be a "Backup of Normal.wbk" file. If you can't chances are good that your keyboard shortcuts and macros are gone. (They were likely in the Normal.dot file that you deleted.) If you find that file, with Word closed, rename your current Normal.dotm file to something else and remember the name. (It has your styles, I believe.) Then rename the backup file to Normal.dotm. Restart Word. Are your macros now available?

By default, recorded macros are stored in the Normal template. That is not necessarily the best place for them but it is the easiest. You can, and IMO should, store your production macros in a separate Global Template (or multiple such templates). Any keyboard shortcuts to those macros should be stored in the same template as the macro. Keyboard shortcut, too, are stored in the Normal template by default.


See also: Moving (Sharing) Customizations in Microsoft Word

For styles, many should likely be stored in document templates. You can have multiple organizations of your [Quick] Styles Gallery using [Quick] Style Sets. They make it easy to update documents and other templates.
Reply With Quote
  #3  
Old 11-11-2021, 01:21 PM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

Thank you, Charles. I didn't know that about templates, so thank you for pointing that out.

I have backups of my macros and customisations, but didn't want to import them because I think the macros are still in the template and/or the documents that use it, even though I can't access VBA and they are not listed in the list of macros. Some but not all of my old shortcuts and macros still work, and as the macro list doesn't show up in the keyboard customisation list I can't reassign shortcuts to them. I didn't want to import the macros again and find that I had duplicates of them in a particular template. Is there any way I can avoid that? (I also have shortcuts on my Quick Access Toolbar for some of the macros.)

Thank you for the links. I shall study them in greater detail when I have more time but I have a job that I need to get on with.
Reply With Quote
  #4  
Old 11-11-2021, 01:42 PM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

For you to edit macros, you need to have the file that contains them open or for it to be an attached template. The exception for this is the Normal.dotm file.


To view and edit macros in a global template, it must be open for editing (or you must have it attached to a document as a document template, a rare thing to do).


Long term. Any keyboard shortcuts or QAT shortcuts to macros should be in the template that holds the macros. Anything else is asking for headaches.
Modifying the Quick Access Toolbar (QAT) in Microsoft Word
Reply With Quote
  #5  
Old 11-11-2021, 02:32 PM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

I still can't see my macros or VBA even though some of them work with the keyboard or QAT shortcuts. Where can I find them?
Reply With Quote
  #6  
Old 11-11-2021, 06:19 PM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

My mother used to tell me, "they are right where you put them." The same applies.
If they are not in your normal.dotm template, they likely are in other Global Templates. They could be found in your Word Startup Folder.
Reply With Quote
  #7  
Old 11-12-2021, 02:04 PM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

I went back to basics and generated a new Normal template in Word, customized it, imported my macros into it and reinstated keyboard shortcuts, and it worked fine for a while, but I'm now finding that I can't seem to add any new macros to the list - or the ones I'm adding do not end up in the macros menu list.

Earlier, I could view all the 'old' macros in VBA, but now, while they're still still in the macros menu, I can't see them in VBA. Earlier, I could add and record macros and all my keyboard shortcuts were working. Now they don't work at all, even though the shortcuts are still there under Options. It feels as though someone happens through the day and things stop working. Now even the macros I add (either through creating a new macro or copying the macro straight into VBA) don't appear in the menu. Presumably they should be in the Modules folder, but both NewMacros and NewMacros1 are 'unviewable'.

In VBA, under Normal, I have subfolders Microsoft Word Objects and Modules. Under Modules I have AboutNoteStripper, NewMacros and NewMacros1. Then there is a Project folder (same level as Normal), which is the current document, which has two subfolders, Microsoft Word Objects and References.

Can anyone please help? (I am using Word 365, but there was no option to select anything newer than 2019.)

Last edited by a_scribe; 11-12-2021 at 02:31 PM. Reason: Add information
Reply With Quote
  #8  
Old 11-12-2021, 05:50 PM
Guessed's Avatar
Guessed Guessed is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,795
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

When I've had problems like this with templates it has been because of the interplay of my hard drive and the Microsoft cloud's OneDrive automatic backup. Essentially your templates might be synchronised in two locations and Word could be finding it hard to have exclusive access to the template because of this.

It is worth exploring your folder settings to work out what folders are automatically backing up on OneDrive and stop that from happening with your templates to see if that allows your templates to work more like the good old days.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #9  
Old 11-13-2021, 10:09 AM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

Quote:
Originally Posted by a_scribe View Post
I went back to basics and generated a new Normal template in Word, customized it, imported my macros into it and reinstated keyboard shortcuts, and it worked fine for a while, but I'm now finding that I can't seem to add any new macros to the list - or the ones I'm adding do not end up in the macros menu list.

Earlier, I could view all the 'old' macros in VBA, but now, while they're still still in the macros menu, I can't see them in VBA. Earlier, I could add and record macros and all my keyboard shortcuts were working. Now they don't work at all, even though the shortcuts are still there under Options. It feels as though someone happens through the day and things stop working. Now even the macros I add (either through creating a new macro or copying the macro straight into VBA) don't appear in the menu. Presumably they should be in the Modules folder, but both NewMacros and NewMacros1 are 'unviewable'.

In VBA, under Normal, I have subfolders Microsoft Word Objects and Modules. Under Modules I have AboutNoteStripper, NewMacros and NewMacros1. Then there is a Project folder (same level as Normal), which is the current document, which has two subfolders, Microsoft Word Objects and References.

Can anyone please help? (I am using Word 365, but there was no option to select anything newer than 2019.)
The modules are the primary holders for basic macros. NewMacros is the module that holds any recorded macros unless you later move them.

If a macro is private, it will not show up in the macros list (Alt+F8) nor can it be called with a keyboard shortcut. It can be run from another macro or from the vba editor.

Here is a screenshot from my Normal project in the vba editor.

Again this is not where I hold the macros I use on a regular basis. (The exception in the mBackupNormal module which is explored here: Backup Normal.dotm template using a macro.) These all hold code that I have developed or picked up over the years that can be useful. The code used for my work is stored in other templates (Add-Ins or Global Templates). I have been gathering these since around 1998 when I picked up the book Word 97 Annoyances.

Public macros that are stored in Global templates will show up in the macros list but will not be available for editing in the vba editor unless that template is somehow open (as discussed earlier). Projects that show up in the editor project explorer that are not viewable are usually loaded Add-Ins.

Are your templates stored on OneDrive or SharePoint? Like Andrew, I can anticipate this as a problem if your User Templates location is a cloud folder. I store mine in DropBox on my computer's hard drive sync folder without problems. If they were in the cloud location, I would anticipate problems, as well. Again, mine is on my hard drive, synced to a cloud location rather in a cloud location synced to my hard drive.
Reply With Quote
  #10  
Old 11-15-2021, 07:23 AM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

Thank you, Andrew and Charles. I seem to have two sets of macro modules in VBA:



(I have uninstalled NoteStripper from my PC but it is still showing up.)

The macros menu doesn't show up every single macro. New ones that are in VBA sometimes don't show up but when I try to create it as a new macro I am asked if I want to replace the existing one, and I can 'step into' it easily (so far today). It simply doesn't show up.

The macros menu I get when customizing keyboard shortcuts is not exactly the same one as for customizing the quick access toolbar (in the same document).





I unlinked OneDrive on my computer but it was up and running again today, so I've set it to stop syncing.

I suspect that I'm looking at two different sets of macros here, most of which overlap as they derive from the same source. It's been suggested to me that I delete one of them and see how that goes. That still doesn't explain why a macros in VBA doesn't show up in the macro menu, however.

Last edited by a_scribe; 11-15-2021 at 08:12 AM. Reason: update
Reply With Quote
  #11  
Old 11-15-2021, 05:02 PM
Guessed's Avatar
Guessed Guessed is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,795
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

If you are being asked about over-writing a macro then it is a pretty clear indication that a macro with the same name is already in the module where you are trying to save it.

However, not EVERY macro will appear in the list of macros to run - for instance Functions or Subs which take inputs won't show in your list since they need to be called from other Subs or Functions.

Your screen caps show the Normal.NewMacros1.FindSamePla... pair of macros are not in the list without the template.module.macro hierarchy. My first suspicion is that you actually have multiple templates active and the code modules are similar but not exactly the same in both. If you have verified that not to be the case then I would look at the full macro names and try to work out what is special about those two macros. It might also be that one of the lists is not sorted alphabetically and those macros appear somewhere else in the list.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #12  
Old 11-15-2021, 08:34 PM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

The macros you see in the Customize Keyboard dialog may be the same as you are seeing in the VBA Editor's project explorer.

Normal.NewMacros1.FindBackCase would be the macro "FindBackCase" in the Module "NewMacros1" in your Normal project (template). If you double-click on the module "NewMacros'" in the project explorer, you will find the listings for the macros in that module. When you are in the editor, with your selection point inside any macro, you can use the Find dialog to find any procedure in that project by name.
Reply With Quote
  #13  
Old 11-17-2021, 02:21 PM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

After backing everything up, I deleted Normal.NewMacros1, and set up a new Normal template again. It seems to have ironed out the problems I had, and all the macros now show up in the menu.

A remaining niggle is that some keyboard shortcuts simply won't 'take', but I can assign a shortcut to the same macros on the QAT. Compared to the problems I've had before, this is a small one, and I can live with it for the time being.

Thank you, Charles and Andrew, for your help with these problems. I shall look into global templates when I have a bit more time. If I did have a Normal template on OneDrive, where would it be located? I've looked and not found anything.
Reply With Quote
  #14  
Old 11-19-2021, 01:50 PM
Charles Kenyon Charles Kenyon is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,755
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

Quote:
Originally Posted by a_scribe View Post
***

Thank you, Charles and Andrew, for your help with these problems. I shall look into global templates when I have a bit more time. If I did have a Normal template on OneDrive, where would it be located? I've looked and not found anything.
Do not bother looking for it. Make sure that the User Templates location for Word is on your local hard drive. The default location is:
Code:
C:\Users\[your username]\Appdata\Roaming\Microsoft\Templates
That folder should not be on OneDrive. It could be a file that is synced to OneDrive but should not be a cloud file. As I indicated earlier, mine is synced to DropBox without any problems.
That location is set through File > Options > Advanced > File Locations and can be different from the default save location for templates. (This is discussed in the link.)
Reply With Quote
  #15  
Old 11-20-2021, 03:29 AM
a_scribe a_scribe is offline VBA project unviewable and problems with macros and shortcuts in templates Windows 10 VBA project unviewable and problems with macros and shortcuts in templates Office 2019
Novice
VBA project unviewable and problems with macros and shortcuts in templates
 
Join Date: Nov 2021
Posts: 9
a_scribe is on a distinguished road
Default

Ah, so there isn't another Word template on OneDrive. My Word template is stored where it should be, so all is well.
Reply With Quote
Reply

Tags
macro help, templates messed up, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error message ["Project is unviewable"] when I try to exit Word; despite my running Debug, Compile [ marceepoo Word VBA 2 05-07-2020 03:48 PM
Keyboard shortcuts won't execute macros in Word 2010 kozureokami Word 4 02-26-2017 03:16 PM
Finding keyboard shortcuts for my macros tcantrell Word VBA 1 12-07-2015 02:04 PM
Importing Macros from 2007 with keyboard shortcuts gyro2222 Word VBA 19 03-02-2015 09:33 AM
VBA project unviewable and problems with macros and shortcuts in templates Word 2007 shortcuts and templates harry Word 1 07-15-2010 12:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft