View Single Post
  #32   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_8_] Peter T[_8_] is offline
external usenet poster
 
Posts: 88
Default IP address to Hostname in Excel

"Andrey G" wrote in message
On Friday, April 14, 2017 at 12:39:40 AM UTC+1,
wrote:
Agreed - thanks Randy and apologies for the confusion re Windows/Office
versions :)

Simon


Dear all,
At work, I've inherited the file that's using Randy Birch's code from
he http://vbnet.mvps.org/index.html?cod...byhostname.htm.
Recently, all machines have been up-dated to Office 64 bit and the code
stopped working.
I've tried everything from Peter T suggestions above, but, still, as soon
as the code gets to line: CopyMemory ptrName, ByVal ptrName, 4, Excel
crashes.
I feel particularly stupid, as it looks that some people in this
conversation have actually managed to adjust original code to 64 bit,
following Peter T's advice.
Any help will be greatly appreciated!

Andrey G


What were my 'suggestions above'...?

It looks like you're attempting to copy a pointer which in x64 will be an
8-bit LongLong, or a 4-bit Long in x32

Try declaring this conditional constant, either as public in a normal module
or as private in the module you call CopyMemory

#If Win64 Then
Public Const gcPtrBytes As Long = 8
#Else
Public Const gcPtrBytes As Long = 4
#End If

and
CopyMemory ptrName, ByVal ptrName, gcPtrBytes

Only a guess with not much to go on!

Peter T