Learning is not attained by chance, it must
be sought for with ardor and diligence.
-Abigail Adams
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  


Microsoft Word Forum
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

This forum is for the discussion of Microsoft Word.

Click Here To Subscribe to this forum and receive an email update whenever new posts are added, just scroll down to the bottom of this page and enter your email address in the comment form.

Permanent Link
Keywords: microsoft word forum
Post New Topic

Read Filename to include Datepicker by Richard F @ 9/20/2013
I solved it.
For anyone interested:
Please excuse the way this is presented (ie. Format, it's hard to copy and paste and see result in these small Post Comments window.

Private Sub CommandButton50_Click()

Dim dMonth As Date
Dim strMonth As String
Dim strYear As String
Dim strFullDay As String
Dim oCtrl As ContentControl

For Each oCtrl In ActiveDocument.ContentControls

    If oCtrl.Tag = "MeetingDay" Then

          If oCtrl.ShowingPlaceholderText = True Then

          MsgBox "You didn't select a date"


dMonth = CDate((ActiveDocument.SelectContentControlsByTag("MeetingDay").Item(1).Range.Text)

      strMonth = Format(dMonth, "MMMM")

      strYear = Format(dMonth, "yyyy")

      strFullDay = Format(dMonth, "DD-MMMM-YYYY")

MsgBox "These Minutes will be saved to: " & "C:\User\Rick\Meetings\" & strYear & "\" & strMonth & "\Meeting Minutes " & strFullDay & ".doc"

ActiveDocument.SaveAs FileName:="C:\User\Rick\Meetings\" & strYear & "\" & strMonth & "\Meeting Minutes " & strFullDay & ".doc"
         End If
Exit For
    End If
Next oCtrl
End Sub
Show Just This Thread        Post Reply
Read Filename to include Datepicker by Richard F @ 9/13/2013
MS Word 2010 - Filename to include Datepicker Value

I have composed a Template/Form in Word 2010 for Team Meeting Minutes. The date of the meeting is selected from a Date Picker Content Control. I have inserted a [Save] button with the purpose of naming the file consistantly, using the value of the Date Picker.

Here is the code:

Private Sub CommandButton50_Click()
ActiveDocument.SaveAs FileName:="C:\Users\Richard\Documents\Meeting Minutes\2013\September\Team Meeting Minutes" & ActiveDocument.Bookmarks("Date").Range.Text & ".doc"
End Sub

What I would like to do, is break the date down into Month and Year components so that the file can be saved in the correct folder sorted by Year and Month.

ie. "C:\Users\rick\Documents\Meeting Minutes\"[year value]\[month value]"\Team Meeting Minutes"&[long date picker value]".doc" - (not macro enabled)

I've searched everywhere on the internet for weeks and am still stumped.
I have had limited success with Format(Value, "yyyy") using msgbox to confirm the values I'm getting but run into all sorts value mismatch problems.

I am supposing my problem is primarily the way I'm calling for the Date Picker value, at this time you'll note I'm using Bookmarks of Date Picker Tag named "Date" (yes I know the name is dangerous and probably should be called "MeetingDay" or similar)

Any suggestions, help appreciated. The full working code would be handy rather than just a part explanation, I'm still very much a Beginner level ability.

Show Just This Thread        Post Reply

Collapse All Topics


Post Your Comments or Subscribe
    If you would like to be notified of new posts on this forum,
    just enter your email address below. It will be kept private.
If you just want to subscribe to get email updates when this forum is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 8+7:
  Notify me when the this forum is updated
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



You may want to read these articles from the 599CD News:

4/18/2017Change Account Password
3/30/2014Help With Passwords
7/29/2013A note about password safety
5/5/2012Keyword Search Cloud
10/7/2009Word 2007 Basic 5 Handbook Done
10/1/2009Two New FREE Microsoft Word Videos
9/30/2009Word 2007 Basic Level 5 Finished
9/12/2009Word 2007 Basic 4 Now Available
9/12/2009Word 2007 Basic 4 Recorded
9/9/2009Word 2007 Basic Level 3 Handbook

Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP