title: 32 bit Excel macro not working with 64 bit
body: <p>Trying to get this 32-bit macro to work on Office 2010 64-bit.  I tried using PTrSafe but cannot get it working.---Novice at this
  Thanks</p>
  
  <pre><code>Option Explicit
  
  Private Declare Function fnGetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  
  
  Public Function GetComputerName()
  Dim strComputerName As String
  Dim lngPos As Long
  Const MAX_COMPUTERNAME_LENGTH = 100
  Application.ScreenUpdating = False
  
      strComputerName = String(MAX_COMPUTERNAME_LENGTH + 1, " ")
  
      If fnGetComputerName(strComputerName, MAX_COMPUTERNAME_LENGTH) = 0 Then
          strComputerName = "ErrorGettingComputerName"
      Else
          lngPos = InStr(1, strComputerName, Chr(0))
          strComputerName = Left(strComputerName, lngPos - 1)
      End If
  
  GetComputerName = strComputerName
  
      Application.Range("Computer_Name") = GetComputerName
  
  Application.ScreenUpdating = True
  End Function
  </code></pre>