I have a following code (two sections):
1. - editing link to external file and updating date in the spreadsheet
and 2. - renaming the file
After running any of these, after the script is finished, I cannot rename or delete a folder "Quotation" with these files inside through Windows Explorer.
Files are being removed successfully, so just folder cannot be removed.
To rename or delete the folder I need to "Reset" (Stop) the script in VBA editor (even if it looks like successfully finished) or close Excel.
Is there any process to release the folder that have been used in the procedure or am I just missing something?
Please help.
1. - editing link to external file and updating date in the spreadsheet
Code:
FileToOpen = ToPath & "\Quotation\XXXX-XX-A_Client_Rev0.xlsm"
Application.StatusBar = "Creating project folder. Please wait... - Updating files"
Workbooks.Open Filename:=FileToOpen
Workbooks("XXXX-XX-A_Client_Rev0.xlsm").Activate
Worksheets("Measures").Activate
ActiveWorkbook.ChangeLink Name:="C:\Project History.xlsx", NewName:=ToPath & "\Project History.xlsx", Type:=xlExcelLinks
ActiveSheet.Range("Revision_date").Select
ActiveCell.Value = Date
ActiveWorkbook.Close SaveChanges:=True
ThisWorkbook.Activate
Code:
Application.StatusBar = "Creating project folder. Please wait... - Renaming files"
FromPath = ToPath & "\Quotation\XXXX-XX-A_Client_Rev0.xlsm"
ToPath1 = ToPath & "\Quotation\" & Left(Project_number, 8) & "A" & Right(LabelProject, Len(LabelProject) - 9) & "_Rev0.xlsm"
Name FromPath As ToPath1
After running any of these, after the script is finished, I cannot rename or delete a folder "Quotation" with these files inside through Windows Explorer.
Files are being removed successfully, so just folder cannot be removed.
To rename or delete the folder I need to "Reset" (Stop) the script in VBA editor (even if it looks like successfully finished) or close Excel.
Is there any process to release the folder that have been used in the procedure or am I just missing something?
Please help.