VBA Saved csv is retaining the Control Buttons - Not a "Real" csv file?

Shiseiji

Board Regular
Joined
Oct 23, 2009
Messages
214
Office Version
  1. 2019
Platform
  1. Windows
Suggestions? I was rather surprised to open the csv file and see the control button's on the screen . . .

Code:
Sub m_copy_save_close()
    Sheets("Start Page").Select
    Sheets("Start Page").Copy
    Dim fname
fname = Application.GetSaveAsFilename(InitialFileName:="AtHoc_SP_", fileFilter:="Excel Files (*.csv), *.csv", Title:="Save As")
If fname = False Then Exit Sub
    ActiveWorkbook.SaveAs Filename:=fname
    ActiveWorkbook.Close False
End Sub

TIA

Ron
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Just because you call the file a csv doesn't mean it's a csv. You have to include the fileformat argument

Code:
    ActiveWorkbook.SaveAs Filename:=fname, fileformat:=xlCSV
 
Upvote 0
Thank you. I learn as I go as needed. I learned a long time ago I'll never be a "real" programmer. So I have to ask and borrow . . .

Ron
 
Upvote 0
Hey Ron - we're all learning here :) (yes, even I post questions. No one person can know it all)
The requirement of a file format is still relatively new, especially for users who are used to classic Excel.
Glad you asked (better than hitting your head against the keyboard. I don't recommend it :))
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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