<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to enable Autofilter AND Write protection in XLSX using DDE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/437456#M282182</link>
    <description>&lt;P&gt;Alternatively you could drop the whole proprietary file format altogether, and go with an open plain text file format like XML, with a plain text style file which renders the XML in the way you want.&amp;nbsp; &amp;nbsp;As you want write protection, this provides it and you can add filters, buttons and other such things.&amp;nbsp; Not to mention its all plain text, so cross platform, future proof etc.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 08:56:43 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-02-15T08:56:43Z</dc:date>
    <item>
      <title>How to enable Autofilter AND Write protection in XLSX using DDE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/436592#M282179</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need: A given XLSX file should be write-protected in some columns, while others should be changeable. In addition I need an Autofilter which should be applied on the protected range. So filtering and sorting must be possible after adding the protection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have: I've wrote a VBS which can be run from a SAS programm using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;X d:\mypath\vbs_script.vbs
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This script you can find here in detail:&lt;/P&gt;&lt;PRE&gt;Set oexcel= CreateObject("Excel.Application")
oexcel.Visible = False

'Open File
Set ThisWorkbook = oexcel.Workbooks.Open("d:\mypath\test.xlsx")
Set sheet = ThisWorkbook.Worksheets("Tabelle1")

'Define write protected range
Set rng = sheet.Range("D:BE")

'Random Password
For x=1 To 15
Randomize
vChar = Int(89*Rnd) + 33
If vChar = 34 Then vChar = 39
RndPassword = RndPassword &amp;amp; Chr(vChar)
Next

'Lock write protected range
rng.Locked = True
sheet.Protect RndPassword

'save File
ThisWorkbook.SaveAs("d:\mypath\test_2.xlsx")

oexcel.Quit&lt;/PRE&gt;&lt;P&gt;It works for the protection part but now I'm stuck with adding the AutoFilter options. I've googled a lot, but I failed with any attempt so far.&lt;/P&gt;&lt;P&gt;Someone here who can help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;KR Bernd&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 07:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/436592#M282179</guid>
      <dc:creator>berndJR</dc:creator>
      <dc:date>2018-02-13T07:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable Autofilter AND Write protection in XLSX using DDE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/436611#M282180</link>
      <description>&lt;P&gt;Whilst it is possible to do such a thing (assuming DDE even has that capability), I really would not recommend it.&amp;nbsp; DDE is ancient, well over 20 years out of support.&amp;nbsp; I would really question why you need such an Excel output file, unless there is specific requirements, and the client is willing to pay big money to faff around with such nonsense then I would drop it.&amp;nbsp; If you can't, then create a template file, and export your data to CSV.&amp;nbsp; Then have a VBA macro which picks up the CSV file, and populates your template file.&amp;nbsp; Its not the greatest process, but would simplify several parts of it.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 09:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/436611#M282180</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-13T09:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable Autofilter AND Write protection in XLSX using DDE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/437417#M282181</link>
      <description>&lt;P&gt;Excel/SAS has been my bread and butter for a long time. DDE is to be avoided at all costs. VBS is also really bad. These are very deprecated technologies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I solve it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use .NET and read the Excel workbook as an object then make the changes. This is very easy technology using free sources. Look at using C# to read Excel then modify that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are running into an issue where there isn't a lot of sources because it is so old using the 2 technologies you mention. Also, a system upgrade could destroy them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ping me if you need some starting points on code but move away from DDE/VBS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 04:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/437417#M282181</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2018-02-15T04:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable Autofilter AND Write protection in XLSX using DDE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/437456#M282182</link>
      <description>&lt;P&gt;Alternatively you could drop the whole proprietary file format altogether, and go with an open plain text file format like XML, with a plain text style file which renders the XML in the way you want.&amp;nbsp; &amp;nbsp;As you want write protection, this provides it and you can add filters, buttons and other such things.&amp;nbsp; Not to mention its all plain text, so cross platform, future proof etc.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 08:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-enable-Autofilter-AND-Write-protection-in-XLSX-using-DDE/m-p/437456#M282182</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-15T08:56:43Z</dc:date>
    </item>
  </channel>
</rss>

