Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2020, 04:11 PM
msVBAnewbie msVBAnewbie is offline Can't get macro to stay in ribbon when reopening document Windows 10 Can't get macro to stay in ribbon when reopening document Office 2016
Novice
Can't get macro to stay in ribbon when reopening document
 
Join Date: Feb 2020
Posts: 2
msVBAnewbie is on a distinguished road
Default Can't get macro to stay in ribbon when reopening document

Hi, First time poster so I hope I am including all relevant information.

I have created a simple macro to allow users to click a button which will note the time and date at which they have done to effectively sign off a document. The code I am using is below and has been working fine when deployed:

Public Sub SignOff_Click()

Selection.TypeText Text:=" "


Selection.InsertDateTime DateTimeFormat:="M/d/yyyy", InsertAsField:=True, _
DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.TypeText Text:=" "
Selection.InsertDateTime DateTimeFormat:="hh:mm:ss", InsertAsField:=True, _
DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.TypeText Text:=" "

End Sub

The goal is to have this option display in the ribbon for all users who open the document. I know how to add this to the ribbon using the Options -> Customize Ribbon -> etc. This works fine once it's added in.

The main issue, and I'm not sure if this makes it even possible to do what I want, is that the document must be saved as a .dot format.

I've attached the working document. The EEG shortcuts with Sign Off Now is the button I am looking to add. All associated code with this button seems to be erased each time I reopen.

Alternatively, if anyone has any other ideas to make this work, I would be happy to hear other options.
Attached Files
File Type: dot 1 Routine EEG ButtonTest_noids.dot (445.0 KB, 3 views)
Reply With Quote
  #2  
Old 02-19-2020, 06:54 PM
Guessed's Avatar
Guessed Guessed is online now Can't get macro to stay in ribbon when reopening document Windows 10 Can't get macro to stay in ribbon when reopening document Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,939
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

Dot format doesn't support Ribbon customisations so even if you were managing to change the ribbon, that won't ever be saved into a .dot template.

Ribbon customisation via the GUI also won't exist on other peoples machines. The GUI only makes customisations to the local machine.

If you saved the template in dotm format, you could add a button to the Quick Access Toolbar and have that saved into the dotm template. This is the best solution for you without spending vast amounts of time learning how to customise a template ribbon.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 02-20-2020, 08:55 AM
msVBAnewbie msVBAnewbie is offline Can't get macro to stay in ribbon when reopening document Windows 10 Can't get macro to stay in ribbon when reopening document Office 2016
Novice
Can't get macro to stay in ribbon when reopening document
 
Join Date: Feb 2020
Posts: 2
msVBAnewbie is on a distinguished road
Default

That is what I was afraid of but unfortunately it has to be saved as a .dot format.

There are only a few systems this needs to work on so I'm happy to customise each system. Sorry for any ignorance, but how can I use the GUI to keep the macro active each time the document is opened?
Reply With Quote
  #4  
Old 02-20-2020, 02:55 PM
Guessed's Avatar
Guessed Guessed is online now Can't get macro to stay in ribbon when reopening document Windows 10 Can't get macro to stay in ribbon when reopening document Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,939
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

The macro will stay 'active' in a dot file if the users enable macros but you won't be able to add a button on the ribbon or qat to run it.

If you have access to a pre-Word 2007 machine, you can add a button on a toolbar. This will then appear on an 'Addins' tab on Word 2007 and later versions of Word.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 02-20-2020, 09:53 PM
gmayor's Avatar
gmayor gmayor is offline Can't get macro to stay in ribbon when reopening document Windows 10 Can't get macro to stay in ribbon when reopening document Office 2016
Expert
 
Join Date: Aug 2014
Posts: 3,299
gmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to allgmayor is a name known to all
Default

The template in the attachment has the 2003 format toolbar on the Add-ins tab of the ribbon already? I have added your macro and a button to call it to that toolbar, which thus appears on the add-ins tab of more recent versions of Word.
Attached Files
File Type: dot 1 Routine EEG ButtonTest_noids.dot (410.5 KB, 2 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does an add-in stay usable if the document is emailed? templeowls Mail Merge 1 04-22-2019 01:56 PM
Can't get macro to stay in ribbon when reopening document Path issue using a macro on the ribbon troels Excel Programming 1 05-26-2015 10:25 AM
Can't get macro to stay in ribbon when reopening document Reopening resets numbered lists irre Mail Merge 1 11-14-2014 04:30 PM
Is it possible to add a custom macro button to the FILE tab of the ribbon in excel sbapabck Excel 2 04-11-2014 07:36 AM
Saving & reopening comparison MarshallAbrams Word 0 03-29-2012 06:19 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 11:06 PM.


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