title: How to automatically toggle Airplane mode on Windows
body: <p>On my laptop I can toggle Airplane mode manually by pressing <kbd>FN</kbd>+<kbd>F12</kbd>, I want to do the same thing automatically from VB6 project or VBA.</p>
  
  <p>I did a lot of search and only found answers about Enable/Disable wireless adapter or using <code>Sendkeys</code> for Windows 8:</p>
  
  <pre><code>Dim WSh As Object
  Set WSh = CreateObject("Wscript.Shell")
  WSh.Run "C:\WINDOWS\system32\rundll32.exe %SystemRoot%\system32\van.dll,RunVAN", , True
  Sleep 200
  WSh.SendKeys " "
  Sleep 1000
  WSh.SendKeys "{ESC}"
  </code></pre>
  
  <p>But this code is not reliable and I don't think it will work on Windows 7 or Windows 10.</p>
  
  <p>So my question is: Is there any reliable way to automatically toggle Airplane mode on Windows.</p>