Save Dialogue Box

drj30026abanba

Board Regular
Joined
Oct 22, 2015
Messages
83
So I have a bunch of .xls files that are annoying to deal with cause it takes forever to close them. I wrote this code to replace the files as .xlsx files

Code:
Sub xls2xlsx ()


For i = 1 To Workbooks.count


With Workbooks(i)


.SaveAs Filename:=.Path & "\" & .Name & "x", FileFormat:=51
Kill Left(.Path & "\" & .Name, Len(.Path & "\" & .Name) - 1)
.Saved = True


End With


Next i


End Sub

So this is fine and dandy and all and I can close the workbook freely without that do you want to save dialogue box coming up. The problem is that when I reopen the workbooks, do nothing, and try to exit out of them, it asks me if I want to save again. If I save then it won't happen the next time. Why doesn't Workbooks(i).Saved = True work to cancel this save message the time I try to close it after i reopen it? And how can I fix this?

Thanks!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I don't know why it happens, but if you just open the file for reading, you can
Code:
Sub MyPrg ()
....
     With Workbooks(i)
          .close False
     End With
End Sub
or
Code:
Sub MyPrg ()
....
     With Workbooks(i)
          .save
          .close False
     End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

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