Question: I have two email address. The first is `address1@domain.com.vn` and the second is `address2@domain.com.vn`. 

I want to copy email subject in microsoft outlook with second address `address2@domain.com.vn` to excel using vba. I use bellow code but it do not work.

```
Sub GetFromInbox()
Dim olapp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim Pst_Folder_Name
Dim MailboxName
'Dim date1 As Date
Dim i As Integer
Sheets("sheet1").Visible = True
Sheets("sheet1").Select
Cells.Select
Selection.ClearContents
Cells(1, 1).Value = "Date"
Set olapp = New Outlook.Application
Set olNs = olapp.GetNamespace("MAPI")
Set Fldr = olNs.ActiveExplorer.CurrentFolder.Items
MailboxName = "address2@domain.com.vn"
Pst_Folder_Name = "Inbox"
Set Fldr = Outlook.Session.Folders(MailboxName).Folders(Pst_Folder_Name)
i = 2
For Each olMail In Fldr.Items
'For Each olMail In olapp.CurrentFolder.Items
ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime
ActiveSheet.Cells(i, 3).Value = olMail.Subject
ActiveSheet.Cells(i, 4).Value = olMail.SenderName
i = i + 1

Next olMail
End Sub

```

Answer: 
The [getopt](https://linux.die.net/man/3/getopt) man page says (emphasis mine):

> 
> The variable optind is the index of the next element to be processed **in argv**.
> 
> 
> 

Your invocation options `-aru` are all contained as a single string in `argv[1]`.
```
#include <stdio.h> #include <unistd.h>
      extern char *optarg;
      extern int optind;
      int main (int argc, char** argv) {
        int c;
      printf("--------- options: ---------\n");
      while ((c = getopt (argc,argv,"abcd:")) != -1) {
          printf("opt: %c arg %s\n", (char)c, optarg);
      }
      argc -= optind - 1;
      argv += optind - 1; 
      printf("------ remaining args: ------\n");
      for (int i = 1; i < argc; i++) {
      printf("argv[%d] = %s\n", i, argv[i]); 
     } 
    }

```