<?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 Office Add-in v7.1: Excel, InsertDataFromLocalMachine with error 'type mismatch' in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Office-Add-in-v7-1-Excel-InsertDataFromLocalMachine-with-error/m-p/967413#M2812</link>
    <description>&lt;P&gt;I'm trying to develop a Excel macro with SAS Add-in v7.1, the macro works fine if I follow the official guideline to have both row of below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Dim SAS As SASExcelAddIn&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the macro includes some functions where SAS add-in is not required and it's possible that people are using it without SAS add-in, therefore I tried late binding with only the 2nd sentence is specified (as below), but in this case, when I use the same code to do data insert from local machine, an error message 'Run-time error 13: Type mismatch' shows, and the dataset won't be inserted to the Excel workbook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, with or without the 1st sentence, the SAS.HelloWorld works always. It seems that without the 1st sentence, there are somethings different but not all of them... but I don't know what it is or what the solution could be...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've pasted the complete code as below. Could anyone help on this topic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sub test()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Dim SAS As SASExcelAddIn&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ThisWorkbook.Sheets.Add after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Set sh = ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Call SAS.InsertDataFromLocalMachine(Name_of_A_File, sh.Range("A1"), 1, True, , , False)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End Sub&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 25 May 2025 08:18:47 GMT</pubDate>
    <dc:creator>JakeChen</dc:creator>
    <dc:date>2025-05-25T08:18:47Z</dc:date>
    <item>
      <title>Office Add-in v7.1: Excel, InsertDataFromLocalMachine with error 'type mismatch'</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Office-Add-in-v7-1-Excel-InsertDataFromLocalMachine-with-error/m-p/967413#M2812</link>
      <description>&lt;P&gt;I'm trying to develop a Excel macro with SAS Add-in v7.1, the macro works fine if I follow the official guideline to have both row of below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Dim SAS As SASExcelAddIn&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the macro includes some functions where SAS add-in is not required and it's possible that people are using it without SAS add-in, therefore I tried late binding with only the 2nd sentence is specified (as below), but in this case, when I use the same code to do data insert from local machine, an error message 'Run-time error 13: Type mismatch' shows, and the dataset won't be inserted to the Excel workbook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, with or without the 1st sentence, the SAS.HelloWorld works always. It seems that without the 1st sentence, there are somethings different but not all of them... but I don't know what it is or what the solution could be...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've pasted the complete code as below. Could anyone help on this topic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sub test()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Dim SAS As SASExcelAddIn&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set SAS = Application.COMAddIns.Item("SAS.Exceladdin").Object&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ThisWorkbook.Sheets.Add after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Set sh = ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Call SAS.InsertDataFromLocalMachine(Name_of_A_File, sh.Range("A1"), 1, True, , , False)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End Sub&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 May 2025 08:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Office-Add-in-v7-1-Excel-InsertDataFromLocalMachine-with-error/m-p/967413#M2812</guid>
      <dc:creator>JakeChen</dc:creator>
      <dc:date>2025-05-25T08:18:47Z</dc:date>
    </item>
  </channel>
</rss>

