problem making CSV file

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
647
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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,969
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
ChDir ActiveWorkbook.Path & "\"
fileSaveName = Sheet3.Range("B11") & " Import File"
Sheet5.Copy

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

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
647
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
 

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
647
it works perfectly (pressed send to soon)

Thanks fluff, you always come up trumps. (y)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,969
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,310
Messages
5,641,450
Members
417,210
Latest member
rins

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
Top