Question: I have a simple function which lets the user select a file using Excel 2010's VBA's msoFileDialogOpen property to select a file. When I run it I get the errror:

> 
> Run-time error '424':
> 
> 
> Object required
> 
> 
> 

Here is the offending line:

```
    Path.Open

```

Here is the entire function:

```
Public Sub Function4_FileExplorer()
Dim file As Variant
'   Start File Explorer to select file containing data (simple GUI, much easier than coding vFileName)
With Application.FileDialog(msoFileDialogOpen)
    .AllowMultiSelect = False
    If .Show Then
        file = .SelectedItems(1)
        Path = file
    End If
    Path.Open
End With
MsgBox file

Exit Sub
ErrorHandler:
MsgBox "Error detected" & vbNewLine & "Error" & Err.Number & _
       Err.Description, vbCritical, "Error Handler: Error " & Err.Number

End Sub

```

How should I fix this run-time error? I Thank you!

Answer: 
I'd create struct for that :

```
struct ValuePair
{
    public string Name  { get; set; }
    public string Id { get; set; }        

    public ValuePair(string name, string id) : this()
    {
        Name = name;
        Id = id;
    }

    public override string ToString()
    {
        return "Name : " + Name + ", Id : " + Id;
    }
}

```

And in your code you can use it:

```
List<ValuePair> data = new List<ValuePair>();
for(int i = 0; i < li.Count; i += 2) 
   data.Add(new ValuePair(li[i], li[i + 1]));

```

then use `data[i].ToString();`
You need to build the output string yourself ...

```
StringBuilder sb = newStringBuilder();
using (FileStream reader = File.OpenRead(@"Data.csv")) // mind the encoding - UTF8
        using (TextFieldParser parser = new TextFieldParser(reader))
        {
            parser.TrimWhiteSpace = true; // if you want
            parser.Delimiters = new[] { "," };
            parser.HasFieldsEnclosedInQuotes = true;
            while (!parser.EndOfData)
            {
                string[] line = parser.ReadFields();

                List<string> li = line.SelectMany(x => x.Split(',')).ToList();

                sb.AppendLine(String.Format("Name: {0}, ID: {1}", li[0],li[1]));

            }
        }
MessageBox.Show(sb.ToString());

```

---

Note that you probably want to delimit the (text) values with `""` (assuming you want to read back from your new format), and that you will also need to decide on a suitable scheme for escaping `"` when it appears in the value.
A common way to do this is replacing each `"` in a value with `""`.

Eg
 FirstValue,1
 Sec"ond"Value",2

would map to

```
Name: "FirstValue", ID:1
Name: "Sec""ond""Value", ID:2

```

If you don't do this then reading back from your new format may be indeterminant.