Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2016, 03:14 AM
PRA007's Avatar
PRA007 PRA007 is offline Working with Dates in Word VBA Windows 7 64bit Working with Dates in Word VBA Office 2010 32bit
Competent Performer
Working with Dates in Word VBA
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default Working with Dates in Word VBA

How to work with dates in word VBA?


for example I get date as string in this format

14 Jun 2011

Now I want to know the difference between current date and the date in string.

Is it possible in word vba?

Whay I want to achieve is

Code:
If (CurrDate-strtxt) > 11 then
 some task
If (currDate-strtxt) > 7 then
 some task
Iff (currDate-strtxt)> 3 then
some task
Reply With Quote
  #2  
Old 01-13-2016, 02:00 AM
macropod's Avatar
macropod macropod is offline Working with Dates in Word VBA Windows 7 64bit Working with Dates in Word VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Try something based on:
Code:
Sub Demo()
Dim MyDate As Date
MyDate = CDate(InputBox("Please input a date", "Date Entry"))
MsgBox "The # days difference between the input date and today is:" & vbCr & vbTab & Int(Now() - MyDate)
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
wordvba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with Dates in Word VBA Assistance with VBA Code to identify and highlight dates in a word doc shaunlthomas Word VBA 1 08-13-2015 05:25 PM
Working with Dates in Word VBA Printing a series in Word docs with future dates Rocky Vet at VAMC Word 2 04-04-2015 04:36 PM
Working with Dates in Word VBA Changing Actual Finish dates changes original Finish dates SomewhereinTX Project 3 12-20-2013 10:25 AM
Working with Dates in Word VBA Sequential Dates in Word Ultrap3 Word 2 02-04-2011 02:53 PM
Stop Word from changing Folder DATES? binar Word 0 08-12-2010 05:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:01 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