Currently I use a script to download a pdf-file, change it to a txt-file, extract info from the txt-file to rename the pdf-file and save it to a certain folder. Besides VBA I use a couple of batch scripts to achieve this. A temporary pdf-file is at first saved to the folder and later on deleted from the folder.
If I go to the folder I need to refresh it manually, then I will not see the file anymore. I looked on the web to see if there was a batch script or vba to refresh or update a folder, but I could not find anything nearly usefull. Is there someone who knows how this can be accomplished through VBA or a batch script?
Sincerely, Richard
Edited from here at 22:18 @Rojo and others: I am looking for code which will refresh a folder in the background. The code below will go to the folder if it is open, refresh it and go back to Outlook. Do not use it out of the VBA Editor in Outlook, because it will go into an annoying loop, which you can just stop by clicking on Outlook. But use a button or some else to execute the code.
Sub ActivateOutlook()
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If err.Number = 429 Then
MsgBox "Outlook is not running"
Else
AppActivate objOutlook.ActiveExplorer.Caption
End If
End Sub
Sub RefreshSavedFiles()
Dim oShellObject
Set oShellObject = CreateObject("Wscript.Shell")
strFolder = "C:\Users\User\Documents\PDF files saved"
oShellObject.AppActivate strFolder
oShellObject.SendKeys "{F5}"
ActivateOutlook
End Sub