View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
davegb davegb is offline
external usenet poster
 
Posts: 573
Default Macro buttons causing XL fatal errors?


Dave Peterson wrote:
Oops. Sorry.

http://groups.google.com/groups?thre...%40tkmsftngp02
is a link to Michael Harris's script to clean up the temp folder.

And depending on how your IT folks disabled scripting, you might not be able to
run this:

Option Explicit
Sub testme()

' Dim FSO As Scripting.FileSystemObject
' Dim myFile As Scripting.File
' Dim TempFolder As Scripting.Folder
' Dim myFolder As Scripting.Folder
' Set FSO = New Scripting.FileSystemObject

Dim FSO As Object
Dim myFile As Object
Dim TempFolder As Object
Dim myFolder As Object
Set FSO = CreateObject("Scripting.FileSystemObject")

Set TempFolder = FSO.GetSpecialFolder(2) 'TemporaryFolder = 2

On Error Resume Next
For Each myFile In TempFolder.Files
FSO.DeleteFile myFile.Path
Next myFile

For Each myFolder In TempFolder.SubFolders
FSO.DeleteFolder myFolder.Path
Next myFolder
On Error GoTo 0

End Sub

The commented lines would be used if you did Tools|references and included a
reference to Microsoft Scripting Runtime. (and comment out the next section).



davegb wrote:

Dave Peterson wrote:
Copy the code
paste into notepad
save as: deletetempfiles.vbs

double click on that when you want to clean the temp files.

(I actually put the .vbs file in a folder and put a shortcut to that .vbs file
on the desktop.)

But Dana DeLouis converted it so that it can be used in xl.

http://groups-beta.google.com/group/...932c72cef21fbe

or

http://tinyurl.com/djnys

davegb wrote:

Dave Peterson wrote:
That temp file can get cluttered pretty fast--maybe cleaning it every day???

I have a VBS script in a folder and a shortcut to it on my desktop.

Since there are lots of programs that fail to clean up after themselves, I like
to run it on demand--either right when I turn on the pc or right before I shut
it off.

It was written by Michael Harris:
http://groups.google.com/groups?thre...%40tkmsftngp02

davegb wrote:
<<snipped
I'm not too sure this fix is working. XL locked up on me yesterday
afternoon, not long after I cleaned out my Temp file. Will keep working
on it....

--

Dave Peterson

Thanks for the additional information. Since I don't know anything
about VB scripting, I wouldn't even know where to start to use that
code. Was wondering if there's a way to do that from Execl VBA so that
when XL is opened, it cleans out the Temp file?

--

Dave Peterson


Dave,
Finally got back to this. I can't run the VB script, my network system
won't allow it. And the link you posted was to a program to reset the
system clock. Do you know where the XL VBA program is to clean out the
Temp file?
Thanks.


--


Thanks again, Dave. But it won't run either. I doubt that any vbscript
file will work. I'm going to contact IT and see if I can get a "special
dispensation".
Dave Peterson