Imports System.Runtime.InteropServices ' add this to code and <DllImport> will work now. ' an alternative would be to use <System.Runtime.InteropServices.DllImport>