Search code examples
vbacolon-equals

What does := mean in VBA


This might be a simple question but I'm searching online for the answer and can't seem to find it.

With the use of the code below as an example, what do these symbols mean. Symbol 1 :="" Symbol 2 :=_

Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _

Solution

  • This is so called "Named argument". Meaning you can pass arguments to PrintOut in any order you like, as long as you name them on the left side of ":=" operator.

    Alternatively you would need to provide all the arguments in the exact order specified here https://msdn.microsoft.com/en-us/library/office/ff840681.aspx

    More on named arguments in VBA here: https://msdn.microsoft.com/en-us/library/office/gg251503.aspx