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 can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,586
Messages
6,125,683
Members
449,249
Latest member
ExcelMA

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