I am running Excel 2010 on Windows 7.
I have to exchange data from Excel to a program that doesn’t play nice … it only wants CSV. I will be doing this repeatedly as the data updates.
How do I automate saving a named range from a worksheet to a file in CSV?
I have the following macro that exports named ranges to an HTML file on my desktop. I am thinking that modifying the bold code will work, but I am not sure.
Sub exportToHTML() ‘ Dim strMyDocs As String strMyDocs = CreateObject(“WScript.Shell”).SpecialFolders(“Desktop”) With ActiveWorkbook.PublishObjects.Add( _ SourceType:=xlSourceRange, _ Filename:=strMyDocs & “[B]page1.htm[/B]“, _ Source:=”[B]grades_1[/B]“, _ [B]HtmlType:=xlHtmlStatic[/B]) .Publish (False) .AutoRepublish = False End With End Sub