Is it possible to delete .MHTML file extensions in Excel using VBA?

bellg

New Member
Joined
May 13, 2014
Messages
29
I'm having trouble deleting an open excel file. I have two workbooks that are open: Filename and Filename2. Both are saved in the same location in windows explorer. The only difference between the two files is that the extension on Filename is .MHTML whereas Filename2 is .XLSM

Does anyone know why the .XLSM file is closing and the .MHTML file is not?

Code:
...

Dim wb As Workbook

Set wb = Workbooks.Open(Directory & Filename)
wb.Close SaveChanges:=False
Set wb = Workbooks.Open(Directory & Filename2)
wb.Close SaveChanges:=False

...

Thanks,
Greg
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,215,851
Messages
6,127,288
Members
449,373
Latest member
jesus_eca

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top