---
name: "VarFormat"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/VarFormat"
---

# VarFormat(3w)

## NAME

**VarFormat** (OLEAUT32.87)

## SYNOPSIS

HRESULT VarFormat\
  (\
   LPVARIANT *pVarIn*,\
   LPOLESTR  *lpszFormat*,\
   int       *nFirstDay*,\
   int       *nFirstWeek*,\
   ULONG     *dwFlags*,\
   BSTR\*     *pbstrOut*\
  )

## DESCRIPTION

Format a variant from a format string.

## PARAMS

*pVarIn* **\[In\]**  Variant to format.

*lpszFormat* **\[In\]**  Format string (see notes).

*nFirstDay* **\[In\]**  First day of the week, (See **[VarTokenizeFormatString(3w)](/VarTokenizeFormatString/3w.md)** for details).

*nFirstWeek* **\[In\]**  First week of the year (See **[VarTokenizeFormatString(3w)](/VarTokenizeFormatString/3w.md)** for details).

*dwFlags* **\[In\]**  Flags for the format (**VAR\_** flags from **"oleauto.h"**).

*pbstrOut* **\[Out\]**  Destination for formatted string.

## RETURNS

**Success:** **S\_OK**. *pbstrOut* contains the formatted value.

**Failure:** **E\_INVALIDARG**, if any parameter is invalid. **E\_OUTOFMEMORY**, if enough memory cannot be allocated. **DISP\_E\_TYPEMISMATCH**, if the variant cannot be formatted.

## NOTES

**-** See Variant-Formats for details concerning creating format strings.

**-** This function uses **LOCALE\_USER\_DEFAULT** when calling **[VarTokenizeFormatString(3w)](/VarTokenizeFormatString/3w.md)** and **VarFormatFromTokens(3w)**.

## IMPLEMENTATION

Declared in **"oleauto.h"**.

Implemented in **"dlls/oleaut32/varformat.c"**.

Debug channel **"variant"**.
