| |
microsoft.public.word.vba.general |
Gil, You may have the function return a value as a string or date. Function GetDateCreated(ByVal FileName As String) As Date Set DSO = CreateObject("DSOleFile.PropertyReader") If the function returns as a date you can use the datediff() function to > One of the document properties is for creation date. >> or something like: >> Dim strDefFilePath As String, strFileToCopy As String >> strSourcePath = "c:\Patients\AMR\" >> strSourcePath = "" ' identify folderA >> ' ... but it needs to move over up to 10 jpg files >> :) >> "gil" <gil...@bellsouth.net> wrote in message >> ? Possibly something like: >> Dim date1 As String >> date1 = Selection.Text >> ' navigation code to new selection >> Dim date2 As String >> date2 = Selection.Text >> Dim folderA As String >> ' identify folderA >> Dim folderB As String >> ' identify folderB >> ' ??? Object.MoveFile Source, Destination >> WordBasic.CopyFileA folderA ?? FileName:= ??, Directory:=folderB >> Cheers & tia >> Gil drsmN0SPAMikleAThotmailD0Tcom.INVALID
I also found this code snippet with Google and modified it to return
Creation Date of a file. (Note: .dll will not work in MacWord)
http://officeone.mvps.org/vba.html
I haven't tested in WinWord because I'm using MacWord 2004 at home.
'Function GetDateCreated(ByVal FileName As String) As String
Dim DSO As Object
Dim DPs As Object
Set DPs = DSO.GetDocumentProperties(FileName)
GetDateCreated = DPs.DateCreated
Set DSO = Nothing
End Function
compare two dates.
> This will work very quickly in WinWord docs to extract document properties.
> http://word.mvps.org/FAQs/MacrosVBA/DSOFile.htm
> Tweak to code found in the .dot template to do what you want.
>> Dim strSourcePath As String, strSourceFile As String
>> Dim objFSO As Object
>> strDefFilePath = "c:\Patients\"
>> strFileToCopy = "TorrTod.doc"
>> strSourceFile = strSourcePath & strFileToCopy
>> strDefFilePath = "" ' identify folderB
>> strFileToCopy = "CartSamu.doc" ' but how to identify by date or time?
>> strSourceFile = strSourcePath & strFileToCopy
>> Gil
>> news:eEBS2KmvHHA.4552@TK2MSFTNGP03.phx.gbl...
>> Hi All, . I am seeking vba code to MOVE files created between date1 and
>> date2 from folderA to folderB?
Russ