<?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: Hi Ahmed Soltan,
I don't… in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74373#M26978</link>
    <description>&lt;P&gt;Were you able to find a solution for this?&lt;/P&gt;
&lt;P&gt;I have got the same type mismatch error.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Aysha M&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Aug 2020 15:10:00 GMT</pubDate>
    <dc:creator>AyshaM</dc:creator>
    <dc:date>2020-08-11T15:10:00Z</dc:date>
    <item>
      <title>Remove Duplication in Excel</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74370#M26975</link>
      <description>hi ,&amp;nbsp;

i want to do in blue prism as the Excel do in Remove Duplicate features

so i created the below&amp;nbsp; code but i have some error can anyone help me ?

the errors&amp;nbsp;

Description: Compiler error at line 35: 'xlYes' is not declared. It may be inaccessible due to its protection level.
Description: Compiler error at line 35: 'Array' is a type and cannot be used as an expression.
Description: Compiler error at line 35: Method arguments must be enclosed in parentheses.

&amp;nbsp;
&amp;nbsp;

&amp;nbsp;

&amp;nbsp;

the Code

Dim sw, dw As Object
Dim ss, ds As Object
Dim excel, sheet, varUsedRange As Object
Dim FilteredCount as Long


Try

sw = GetWorkbook(Handle, Source_Workbook)
ss = GetWorksheet(Handle, Source_Workbook, Source_Worksheet)


sw.Activate()
ss.Activate()
excel = ss.Application
sheet = excel.ActiveSheet

varUsedRange = sheet.UsedRange().address &amp;nbsp; 'you can give your own Range

If sheet.AutoFilterMode Then
&amp;nbsp; &amp;nbsp; sheet.AutoFilterMode = False &amp;nbsp; &amp;nbsp;'Turn off filters if already applied
End If
&amp;nbsp; &amp;nbsp;


sheet.Range("A1:C100").RemoveDuplicates Columns:=Array(1,2), Header:=xlYes

Success = True

Catch e As Exception
&amp;nbsp; &amp;nbsp; Success = False
&amp;nbsp; &amp;nbsp; Message = e.Message
Finally
&amp;nbsp; &amp;nbsp; sw = Nothing
&amp;nbsp; &amp;nbsp; ss = Nothing
&amp;nbsp; &amp;nbsp; dw = Nothing
&amp;nbsp; &amp;nbsp; ds = Nothing
&amp;nbsp; &amp;nbsp; excel = Nothing
&amp;nbsp; &amp;nbsp; sheet = Nothing
&amp;nbsp; &amp;nbsp; varUsedRange = Nothing
End Try</description>
      <pubDate>Sat, 09 Feb 2019 19:35:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74370#M26975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-09T19:35:00Z</dc:date>
    </item>
    <item>
      <title>Hi Ahmed Soltan,
I don't…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74371#M26976</link>
      <description>Hi&amp;nbsp;Ahmed Soltan,
I don't give you the full solution, but rather some hints.
You are adapting VBA code to work in VB.net, which is indeed a good way when trying to extend the Excel VBO functionality.
Excel VBA itself knows that has xlYes&amp;nbsp;a value of 1 (And xlNo&amp;nbsp;a value of 2), BluePrism does not know this. Hence you need to declare and assign xlYes.
In Excel VBA, indeed an array can be done with Array(), in VB.net you just put it between curly brackets.
Hope this helps you in the right direction.
Don't hesitate to write again if still stuck.
--------------------------------------------------------------------------------------------------------
Dim sw As Object = nothing
dim dw As Object = nothing
Dim ss As Object = nothing&amp;nbsp;
dim ds As Object = nothing
Dim excel As Object = nothing
dim sheet As Object = nothing
dim varUsedRange As Object = nothing
Dim FilteredCount as Long = 0dim xlYes as integer = 1
Try
&amp;nbsp;&amp;nbsp; &amp;nbsp;sw = GetWorkbook(Handle, Source_Workbook)
&amp;nbsp;&amp;nbsp; &amp;nbsp;ss = GetWorksheet(Handle, Source_Workbook, Source_Worksheet)
&amp;nbsp;&amp;nbsp; &amp;nbsp;sw.Activate()
&amp;nbsp;&amp;nbsp; &amp;nbsp;ss.Activate()
&amp;nbsp;&amp;nbsp; &amp;nbsp;excel = ss.Application
&amp;nbsp;&amp;nbsp; &amp;nbsp;sheet = excel.ActiveSheet
&amp;nbsp;&amp;nbsp; &amp;nbsp;varUsedRange = sheet.UsedRange().address &amp;nbsp; 'you can give your own Range
&amp;nbsp;&amp;nbsp; &amp;nbsp;If sheet.AutoFilterMode Then
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sheet.AutoFilterMode = False &amp;nbsp; &amp;nbsp;'Turn off filters if already applied
&amp;nbsp;&amp;nbsp; &amp;nbsp;End If
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp; &amp;nbsp;sheet.Range(""A1:C100"").RemoveDuplicates(Columns:={1,2}, Header:=xlYes)
&amp;nbsp;&amp;nbsp; &amp;nbsp;Success = True
Catch e As Exception
&amp;nbsp; &amp;nbsp; Success = False
&amp;nbsp; &amp;nbsp; Message = e.Message
Finally
&amp;nbsp; &amp;nbsp; sw = Nothing
&amp;nbsp; &amp;nbsp; ss = Nothing
&amp;nbsp; &amp;nbsp; dw = Nothing
&amp;nbsp; &amp;nbsp; ds = Nothing
&amp;nbsp; &amp;nbsp; excel = Nothing
&amp;nbsp; &amp;nbsp; sheet = Nothing
&amp;nbsp; &amp;nbsp; varUsedRange = Nothing
End Try</description>
      <pubDate>Thu, 14 Feb 2019 01:00:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74371#M26976</guid>
      <dc:creator>BastiaanBezemer</dc:creator>
      <dc:date>2019-02-14T01:00:00Z</dc:date>
    </item>
    <item>
      <title>RE: Hi Ahmed Soltan,
I don't…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74372#M26977</link>
      <description>Hi Bastiaan,&lt;BR /&gt;&lt;BR /&gt;Greetings!&lt;BR /&gt;&lt;BR /&gt;I had tried the code which you mentioned above. When I ran I am getting an error saying Type Mismatch. Any suggestions.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried another method of initialising Columns as an Objects of Array. Even that failed as well. Please in case you have any solution let me know.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Swaroop M&lt;BR /&gt;Consultant&lt;BR /&gt;EY&lt;BR /&gt;Asia/Kolkata&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:00:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74372#M26977</guid>
      <dc:creator>SwaroopM</dc:creator>
      <dc:date>2020-01-23T19:00:00Z</dc:date>
    </item>
    <item>
      <title>RE: Hi Ahmed Soltan,
I don't…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74373#M26978</link>
      <description>&lt;P&gt;Were you able to find a solution for this?&lt;/P&gt;
&lt;P&gt;I have got the same type mismatch error.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Aysha M&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Aug 2020 15:10:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Remove-Duplication-in-Excel/m-p/74373#M26978</guid>
      <dc:creator>AyshaM</dc:creator>
      <dc:date>2020-08-11T15:10:00Z</dc:date>
    </item>
  </channel>
</rss>

