KMC
KMC

Reputation: 20036

What are <> and n$ in VBA?

What do this "<>" and n$ do in VBA?

For example if I have the follow code:

  If ThisWorkbook.Path <> Application.StartupPath And Dir(Application.StartupPath & "\" & "1006.xls") = "" Then
    Application.ScreenUpdating = False
    ThisWorkbook.Sheets("StartUp").Copy
    ActiveWorkbook.SaveAs (Application.StartupPath & "\" & "1006.xls")
    n$ = ActiveWorkbook.Name
    ActiveWindow.Visible = False
    Workbooks("1006.xls").Save
    Workbooks(n$).Close (False)
  End If

Upvotes: 0

Views: 219

Answers (2)

chris neilsen
chris neilsen

Reputation: 53126

In n$ the $ forces the variable n to be String

<> is not equal

Upvotes: 3

Tezyn
Tezyn

Reputation: 1344

<> is an inequality operator

http://msdn.microsoft.com/en-us/library/215yacb6(v=vs.80).aspx

Isn't the $ at the end of a variable to define it as a string variable? I think that is older style

Upvotes: 4

Related Questions