G
Guest
Hi, I'm currently using a macro to prompt a user to save a sheet as a CSV
file. I already have code in place that hides all the unwanted cells and
whilst the CSV file saves perfectly when done manually, looking like this:
asf,adsff,fsdf
gtre,ffdf,etth
when I run the appropriate part of the code, which is this:
Do
fname = Application.GetSaveAsFilename(fileFilter:="CSV files (*.csv), *.csv")
Loop Until fname <> False
Workbooks(newreport).SaveAs Filename:=fname, FileFormat:=xlCSV,_
CreateBackup:=False, Local:=True
Workbooks(fname).Saved = True
Workbooks(fname).Close
it produces a CSV file that looks like this:
asaf,dsdf,fadsf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
fdsd,fdsf,fdsf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
I just can't figure out why this is happening, even if I go and actually
record the code there appears to be no differences.. Can any one help?
Thanks in advance!
file. I already have code in place that hides all the unwanted cells and
whilst the CSV file saves perfectly when done manually, looking like this:
asf,adsff,fsdf
gtre,ffdf,etth
when I run the appropriate part of the code, which is this:
Do
fname = Application.GetSaveAsFilename(fileFilter:="CSV files (*.csv), *.csv")
Loop Until fname <> False
Workbooks(newreport).SaveAs Filename:=fname, FileFormat:=xlCSV,_
CreateBackup:=False, Local:=True
Workbooks(fname).Saved = True
Workbooks(fname).Close
it produces a CSV file that looks like this:
asaf,dsdf,fadsf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
fdsd,fdsf,fdsf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
I just can't figure out why this is happening, even if I go and actually
record the code there appears to be no differences.. Can any one help?
Thanks in advance!