problem making CSV file

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
680
Office Version
  1. 365
Hi All

I'm having a problem creating a csv file, I have been trying for over an hour now and cant see where I'm going wrong.

I can create the pdf's no problem, but I'm going around in circles with the csv file to finish the job.

I've bolded the troublesome part

Any help would be greatly appreciated,

Cheers

Paul

VBA Code:
Sheet3.Activate
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Customer Letter"
    
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
        
Sheet4.Activate
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Service Schedule"
    
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
      
'save as csv
Sheet5.Activate
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Import File"
    
[B]'this is the bit I'm having a problem with
ActiveSheet.ExportAsFixedFormat Type:=xlCSV, Filename:=fileSaveName
'I can't seem to get this correct[/B]

MsgBox Sheet3.Range("D11").Value & " " & "Customers Details Saved 

"
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
How about
VBA Code:
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Import File"
Sheet5.Copy

ActiveWorkbook.SaveAs fileSaveName & ".csv", xlCSV
Bad luck last Saturday.
 
Upvote 0
How about
VBA Code:
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Import File"
Sheet5.Copy

ActiveWorkbook.SaveAs fileSaveName & ".csv", xlCSV
Bad luck last Saturday.
Hi Fluff

I wont say we were robbed, we didn't deserve to be playing for a grand slam, poor 6 nations all round i think

The above is a lot better than I achieved
 
Upvote 0
it works perfectly (pressed send to soon)

Thanks fluff, you always come up trumps. (y)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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