AnotherHiggins
Technical User
We have recently moved to Lotus Notes.
Whenever you open a file from Lotus, it saves the file in a temp folder. If you open another file with the same name without clearing out the temp folder (which is automatically done on reboot), the file opens with a random string for a name.
This causes me some headaches for reasons I won't go into here.
The trick is that the temp folder has a random element to its name. For example, right now the folder is named notes6030C8. But another time it might be named notesFFF692.
The Notes Temp folder is always in the same parent folder, of course - C:\Documents and Settings\UserName\Local Settings\Temp\
In order to share this with others, I made the UserName dynamic, but I can't work out how to deal with the variable folder name.
What I have so far:
But it doesn't accept the wildcard in the folder name. I can understand why: what if there were more than one folder meeting the criteria....
Maybe I could wrap the whole thing in a FileSystemObject and look for the matching folder that way? Is there an easier way?
[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]
Help us help you. Please read FAQ 181-2886 before posting.
Whenever you open a file from Lotus, it saves the file in a temp folder. If you open another file with the same name without clearing out the temp folder (which is automatically done on reboot), the file opens with a random string for a name.
This causes me some headaches for reasons I won't go into here.
The trick is that the temp folder has a random element to its name. For example, right now the folder is named notes6030C8. But another time it might be named notesFFF692.
The Notes Temp folder is always in the same parent folder, of course - C:\Documents and Settings\UserName\Local Settings\Temp\
In order to share this with others, I made the UserName dynamic, but I can't work out how to deal with the variable folder name.
What I have so far:
Code:
Sub DeleteTempNotesExcelFiles()
FilePath = "C:\Documents and Settings\" & GetUserName & "\Local Settings\Temp\notes[highlight][red]*[/red][/highlight]"
Dim fs
Set fs = Application.FileSearch
On Error Resume Next
With fs
.LookIn = FilePath
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count
Kill .FoundFiles(i)
Next i
End With
On Error GoTo 0
Set fs = Nothing
End Sub
But it doesn't accept the wildcard in the folder name. I can understand why: what if there were more than one folder meeting the criteria....
Maybe I could wrap the whole thing in a FileSystemObject and look for the matching folder that way? Is there an easier way?
[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]
Help us help you. Please read FAQ 181-2886 before posting.