<?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 In any case, if you are in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55087#M9490</link>
    <description>In any case, if you are copying values only, then try to avoid using the clipboard. There is no point messing with the clipboard if any other developer has not cleared it etc. It also has no advantage over the below code:
Dim sheet as Object
sheet = GetWorkSheet(handle, workbook, worksheet)   'declare params
Dim arr as Object(,)
arr = sheet.Range(srcRangeString).Value2   'declare param srcRangeString
Dim destSheet as Object
destSheet = GetWorksheet(destHandle, destWorkbook, destWorksheet)   'declare params
Dim destRange as Object
destRange = destSheet.Range(startCell).Resize(arr.GetUpperbound(0), arr.getUpperBound(1))   'declare param startCell to represent the top left destination cell
destRange.Value = arr  'one-stop value transfer from array to range
If you wanted to follow the code in the Excel VBO, then you could do instead:
.....
.....
destination.PasteSpecial(-4163)  'xlPasteValues</description>
    <pubDate>Tue, 18 Jul 2017 21:16:00 GMT</pubDate>
    <dc:creator>Anton__Hosang</dc:creator>
    <dc:date>2017-07-18T21:16:00Z</dc:date>
    <item>
      <title>Excel Paste Special</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55085#M9488</link>
      <description>Hi

I am trying to amend the 'Copy and Paste Worksheet Range' action in the MS Excel VBO so that it will paste values rather than formulae.

I am using the info at the following link for reference:

&lt;A href="https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.pastespecial.aspx" target="test_blank"&gt;https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.pastespecial.aspx&lt;/A&gt;

I can not figure out how to use the XlPasteType constants to specify that I want it to use xlPasteValues.

I tried changing the line in the code from

sheet.Paste()

to

sheet.PasteSpecial(XlPasteType.xlPasteValues)

but it doesn't work.

Can anyone advise?

Thanks</description>
      <pubDate>Tue, 18 Jul 2017 19:18:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55085#M9488</guid>
      <dc:creator>NiallFee</dc:creator>
      <dc:date>2017-07-18T19:18:00Z</dc:date>
    </item>
    <item>
      <title>The Worksheet Object has a</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55086#M9489</link>
      <description>The Worksheet Object has a different PasteSpecial parameter list to the Range.PasteSpecial method.
You really want the Range.PasteSpecial method for your purpose.</description>
      <pubDate>Tue, 18 Jul 2017 20:49:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55086#M9489</guid>
      <dc:creator>Anton__Hosang</dc:creator>
      <dc:date>2017-07-18T20:49:00Z</dc:date>
    </item>
    <item>
      <title>In any case, if you are</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55087#M9490</link>
      <description>In any case, if you are copying values only, then try to avoid using the clipboard. There is no point messing with the clipboard if any other developer has not cleared it etc. It also has no advantage over the below code:
Dim sheet as Object
sheet = GetWorkSheet(handle, workbook, worksheet)   'declare params
Dim arr as Object(,)
arr = sheet.Range(srcRangeString).Value2   'declare param srcRangeString
Dim destSheet as Object
destSheet = GetWorksheet(destHandle, destWorkbook, destWorksheet)   'declare params
Dim destRange as Object
destRange = destSheet.Range(startCell).Resize(arr.GetUpperbound(0), arr.getUpperBound(1))   'declare param startCell to represent the top left destination cell
destRange.Value = arr  'one-stop value transfer from array to range
If you wanted to follow the code in the Excel VBO, then you could do instead:
.....
.....
destination.PasteSpecial(-4163)  'xlPasteValues</description>
      <pubDate>Tue, 18 Jul 2017 21:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55087#M9490</guid>
      <dc:creator>Anton__Hosang</dc:creator>
      <dc:date>2017-07-18T21:16:00Z</dc:date>
    </item>
    <item>
      <title>Thanks very much for your</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55088#M9491</link>
      <description>Thanks very much for your help.  I hadn't noticed the difference between the Worksheet and Range methods.
I also wasn't familiar with the array functionality you laid out.
Thanks again!</description>
      <pubDate>Wed, 19 Jul 2017 13:27:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Paste-Special/m-p/55088#M9491</guid>
      <dc:creator>NiallFee</dc:creator>
      <dc:date>2017-07-19T13:27:00Z</dc:date>
    </item>
  </channel>
</rss>

