mikke3141
03-14-2010, 12:35 PM
Hello,
I have created a xlam file containing different useful macros at our office. I sometimes send a new updated file to the macro users and I would like the file attached to the mail automatically to repleace the old one when the xlam file has been opened. The issues is that when the user opens the file with excel, the old xlam is automatically opened.
The file that should be replaces is C:\Documents and Settings\z412341\Application Data\Microsoft\Excel\XLSTART\work_macros.xlam
We are not allowed to run any own exe files on our computers.
Sub replace_file()
Dim xlobj As Object
Set xlobj = CreateObject("Scripting.FileSystemObject")
abu = Application.VBE.ActiveVBProject.Filename
xlobj.CopyFile abu, "C:\Documents and Settings\z412341\Application Data\Microsoft\Excel\XLSTART\work_macros.xlam"
Set xlobj = Nothing
End Sub
I have tried the code above, but it does not work as the macrofile is already in use when excel is opened.
Thank you for your help.
I have created a xlam file containing different useful macros at our office. I sometimes send a new updated file to the macro users and I would like the file attached to the mail automatically to repleace the old one when the xlam file has been opened. The issues is that when the user opens the file with excel, the old xlam is automatically opened.
The file that should be replaces is C:\Documents and Settings\z412341\Application Data\Microsoft\Excel\XLSTART\work_macros.xlam
We are not allowed to run any own exe files on our computers.
Sub replace_file()
Dim xlobj As Object
Set xlobj = CreateObject("Scripting.FileSystemObject")
abu = Application.VBE.ActiveVBProject.Filename
xlobj.CopyFile abu, "C:\Documents and Settings\z412341\Application Data\Microsoft\Excel\XLSTART\work_macros.xlam"
Set xlobj = Nothing
End Sub
I have tried the code above, but it does not work as the macrofile is already in use when excel is opened.
Thank you for your help.