# VBA optional arguments using NETLink

**URL:** <https://community.wolfram.com/t/vba-optional-arguments-using-netlink/12848>\
**Category:** Questions\
**Tags:** mathematica, external-interfaces, packages-and-paclets\
**Created:** [July 16, 2018, 7:41pm UTC](https://community.wolfram.com/t/vba-optional-arguments-using-netlink/12848 "2018-07-16T19:41:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericsmith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ericsmith/32/2637_2.png) [@ericsmith](https://community.wolfram.com/u/ericsmith)\
**Post date:** [July 16, 2018, 7:41pm UTC](https://community.wolfram.com/t/vba-optional-arguments-using-netlink/12848/1 "2018-07-16T19:41:24Z")

</div>

I’m using NETLink to modify an Excel file. I’d like to copy a sheet and put it after a specified sheet. The Microsoft documentation for the copy function is [here](https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/sheets-copy-method-excel). I can’t figure out how to set an optional argument for the copy function.

example code:

```
Needs["NETLink`"]
InstallNET["Force32Bit"->True]
excelObj=CreateCOMObject["Exel.Application"]
wb=excelObj@Workbooks@Open["~/example.xlsx"]
sheets=wb@Worksheets
sheets[1]@Copy[(*what do I put here?*),sheets[1]]

```

In this example code I’m trying to copy the first sheet and insert the new sheet after the first sheet. There are workarounds, but in general, how do I deal with optional arguments like this using NETLink?  
[1]: [Sheets.Copy method (Excel) | Microsoft Learn](https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/sheets-copy-method-excel)
