# vbaCopyBytes
{: .no_toc }

Copies a block of bytes from one address to another.

Syntax: **vbaCopyBytes(** *Length* **,** *Dest* **,** *Src* **)** **As LongPtr**

*Length*
: *required* **Long**. The number of bytes to copy.

*Dest*
: *required* **LongPtr**. The destination address.

*Src*
: *required* **LongPtr**. The source address.

The behaviour for overlapping ranges is unspecified --- use a temporary buffer if the ranges may overlap. The return value is *Dest* (the same address that was passed in), provided as a convenience for chaining.

### Common Errors

| Error | When |
|---|---|
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | an argument is **Null** |

### Example

```tb check_build
Dim src As String = "Hello"
Dim dst(0 To 9) As Byte
vbaCopyBytes 10, VarPtr(dst(0)), StrPtr(src)
```

### See Also

- [vbaCopyBytesZero](/tB/Modules/HiddenModule/vbaCopyBytesZero.md) function
- [GetMem4](/tB/Modules/HiddenModule/GetMem4.md), [PutMem4](/tB/Modules/HiddenModule/PutMem4.md) procedures
