Close CSV without Saving

SDSSDS

New Member
Joined
Dec 8, 2010
Messages
3
Hi guys, I need some help with a macro Im trying to make

All I am doing is cycling through a folder of .xlsb and saving them as a CSV file and then close

The latter part Im having difficulties with, any code that I try using to close without saving does not work.

When I run the macro, it still asks me if i want to save it down despite having the "False" command at the end

CAn anyone help me, ive always had this issue before but never overcome it

THanks

Below is my code

Do While xExitFile <> ""
Set xWorkBooks = Workbooks.Open(xStrPath & xExitFile)
Application.DisplayAlerts = False
Sheets("Output").Select
xFileCSV = xOutput & Left(xExitFile, 8) & ".csv"
xWorkBooks.SaveAs Filename:=xFileCSV, FileFormat:=xlCSV, CreateBackup:=False
Workbooks(Left(xExitFile, 8) & ".csv").Close False
Application.DisplayAlerts = True
Set xWorkBooks = Nothing
xExitFile = Dir
Loop
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Maybe
Code:
...
xWorkBooks.SaveAs Filename:=xFileCSV, FileFormat:=xlCSV, CreateBackup:=False
[COLOR=#0000ff]ActiveWorkbook.Saved = True
ActiveWorkbook.Close[/COLOR]
Application.DisplayAlerts = True
Set xWorkBooks = Nothing
...
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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