Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2017, 04:12 PM
Ulodesk Ulodesk is offline Strange macro behavior in 2016 Windows 7 64bit Strange macro behavior in 2016 Office 2013
Word 2013 Expert Cert
Strange macro behavior in 2016
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default Strange macro behavior in 2016


A family member is using Word 2016 in Windows 10. I recorded a simple macro for her to insert a date field, a soft return, then a time field, then changing the field to plain text, right-aligning the paragraph, decreasing the point size, and starting a new blank paragraph at left. Works flawlessly in my Word 2010 in W7. In hers, it inserts the dateline, sends it to the right, and then selects that and anything below it. End. The field is still a field (content control, it appears -- could that be the problem?), and the time line never appears.

I have looked through Options for any setting that might be affecting this but can't figure it out. Is there some compatibility problem that won't allow me to successfully record this macro for 2016? I recorded it on my machine, simply because I found it easier that the wretched touchpad on her laptop and related laptop interface problems.

Thanks.

Last edited by Ulodesk; 04-01-2017 at 04:13 PM. Reason: typos
Reply With Quote
  #2  
Old 04-01-2017, 05:25 PM
Charles Kenyon Charles Kenyon is offline Strange macro behavior in 2016 Windows 10 Strange macro behavior in 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Is there some reason to not create an AutoText entry with these using CreateDate Fields?

Using Date Fields in Microsoft Word
Automated Boilerplate Using Microsoft Word

Otherwise, you might do better simply inserting the date and time in a macro rather than inserting a field and then unlinking it.
Reply With Quote
  #3  
Old 04-02-2017, 05:55 AM
gmayor's Avatar
gmayor gmayor is offline Strange macro behavior in 2016 Windows 10 Strange macro behavior in 2016 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

An autotext as suggested by Charles would do the job, or you could use a simple macro
Code:
Sub InsertDateandTime()
Dim orng As Range
    Set orng = Selection.Range
    orng.ParagraphFormat.Alignment = wdAlignParagraphLeft
    orng.Text = Format(Date, "d mmmm yyyy") & vbCr & Format(Time, "hh:mm am/pm")
    orng.Collapse 0
    orng.Select
lbl_Exit:
    Set orng = Nothing
    Exit Sub
End Sub
Change the date and time formats as required.
__________________
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
  #4  
Old 04-02-2017, 08:26 AM
Ulodesk Ulodesk is offline Strange macro behavior in 2016 Windows 7 64bit Strange macro behavior in 2016 Office 2013
Word 2013 Expert Cert
Strange macro behavior in 2016
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default

Thank you, gentlemen. I was not aware of the CreateDate field, but I have now used it in a recorded macro in place of the Date field that was turning into a content control in Word 2016. Recording the macro allows me to make the several additional adjustments I mentioned in my original post and run the macro with an [Alt+letter] keystroke.

I'll mark this solved if I can find the item; usually, it is missing.
Reply With Quote
  #5  
Old 04-02-2017, 09:02 AM
Charles Kenyon Charles Kenyon is offline Strange macro behavior in 2016 Windows 10 Strange macro behavior in 2016 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Glad you got what you need. FYI A keyboard shortcut can also be attached to an AutoText entry.

AutoText advantage: can use in an environment that does not allow macros to run. Will sometimes work where a recorded macro will misfire.
AutoText disadvantages: can only be stored in a template, not a document; more difficult to add to the QAT.
Reply With Quote
  #6  
Old 04-02-2017, 03:34 PM
macropod's Avatar
macropod macropod is offline Strange macro behavior in 2016 Windows 7 64bit Strange macro behavior in 2016 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

FWIW, the AutoText entry could be reduced to a single field coded as:
{CREATEDATE \@ "D MMMM YYYY'↵
'hh:mm am/pm"}
where ↵ is an actual manual line break.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange macro behavior in 2016 Excel for Mac 2016 - Macro issue theUKshrew Excel Programming 1 02-10-2017 11:16 PM
Strange macro behavior in 2016 Strange OLE Link Behavior after emailing or moving a File ptmuldoon Word 1 12-03-2014 02:28 PM
Strange macro behavior in 2016 Microsoft Office Windows Strange Behavior jg60 Word 8 06-14-2012 09:51 AM
Outlook Auto-Reply Rule - Strange behavior albracco Outlook 5 09-27-2011 08:18 AM
Strange macro behavior in 2016 Pasting - strange behavior SatControl Word 5 02-14-2010 12:57 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:39 AM.


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