Hi,
I want to put together a script that will automatically print the newest file in a folder every morning. I can build this in Excel, but want to have it as an isolated VBS.
Any thoughts?
Thank you.
Hi,
I want to put together a script that will automatically print the newest file in a folder every morning. I can build this in Excel, but want to have it as an isolated VBS.
Any thoughts?
Thank you.
Do you have any code written so far?
Regards,
JP
Read the FAQ
Getting free help on the web
My website
Please use [vba][/vba] tags when posting code
Option Explicit
Dim objFSO, objFile, strFileProperties, colFiles, strFiles
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Test\Document1.txt") Then
Set objFile = objFSO.GetFile("C:\Test\Document1.txt")
' Display generel file properties
strFileProperties = strFileProperties & "File name: " & objFile.Name & VbCrLf
strFileProperties = strFileProperties & "File path: " & objFile.Path & VbCrLf
strFileProperties = strFileProperties & "Folder placed on drive: " & objFile.Drive & VbCrLf
strFileProperties = strFileProperties & "Date created: " & objFile.DateCreated & VbCrLf
strFileProperties = strFileProperties & "Date last accessed: " & objFile.DateLastAccessed & VbCrLf
strFileProperties = strFileProperties & "Date last modified: " & objFile.DateLastModified & VbCrLf
strFileProperties = strFileProperties & "Parent folder: " & objFile.ParentFolder & VbCrLf
strFileProperties = strFileProperties & "File size: " & objFile.Size & " bytes" & VbCrLf
strFileProperties = strFileProperties & "File type: " & objFile.Type & VbCrLf
MsgBox strFileProperties
Else
MsgBox "Selected file does not exist!"
End If
In other words, loop through the folder and check either .DateCreated or .DateLastModified (or maybe both), then, depending on the filetype, print it. How do to that, depends on the particular filetype.
Regards,
JP
Read the FAQ
Getting free help on the web
My website
Please use [vba][/vba] tags when posting code