-
Delete Add-in with code
I am writing an un-install option into my program and I am trying to have it delete the add-in from the users add-ins folder when they run it. This is the code I tried and it says subscript out of range:
[VBA]Workbooks("C:\Documents and Settings\" & Environ("username") _
& "\Application Data\Microsoft\Addins\Business Reporting Today.xla").Delete[/VBA]
Is this possible?
-
Are you trying to delete the file that contains the uninstall code? I don't think you can do this.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
yeah that was what I was trying. Thank you for your help.
-
[vba]
GoTo ErrorHandler
With ThisWorkbook
If .Path "" Then
.Saved = True
.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
End If
End With
Exit Sub
ErrorHandler:
MsgBox "Fail to delete file: " & ThisWorkbook.FullName
Exit Sub
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules