WeardeQuay
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by WeardeQuay
-
-
This is as far as I can get with the macro, I do not understand the find a string part. Can anyone help.
Sub Diary2016()'' Diary2016 Macro'' ChangeFileOpenDirectory "X:WORD Documents" Documents.Open FileName:="X:WORD DocumentsDiary 2016.docx", _ ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", Revert:=False, _ WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _ wdOpenFormatAuto, XMLTransform:=""
Dim ToDaysDate As String
ToDaysDate = "& Day(Now) & Month(Now) & Year(Now)"
Find: Selection.Find.ClearFormatting With Selection.Find .Text = "ToDaysDate" .Replacement.Text = " " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute
End Sub
-
I am trying to make a macro that will open a document and put the curser on today's date, I thought that would be an easy first macro for me to write but it has not worked out that way. I am attempting to purchase a book dealing with as it's the reason for the macro a complete macro guide for Office 365, has anyone heard of one.Alan
Search document for today's date
in VBScript
Posted
At last the code works thanks for the help with the date formatting.
Sub Dairy2015()'' Dairy2015 Macro ChangeFileOpenDirectory "X:WORD Documents" Documents.Open FileName:="X:WORD DocumentsDiary 2015.docx", _ ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", Revert:=False, _ WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _ wdOpenFormatAuto, XMLTransform:="" DaysDate = Format(Now(), "Long Date")
Find: Selection.Find.ClearFormatting With Selection.Find .Text = DaysDate .Replacement.Text = " " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute End Sub