Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Getting Host Name

Hi,

Does anyone know the VBA for getting the host name of a server (Windows
Server 2003) that an Excel spreadsheet (Excel 2003) is sitting on (I don't
mean path info, as I already know this and the host name doesn't show up).

I'm trying to set-up a trigger, so that if an Excel file is removed from the
server onto someones PC the file will behave differently.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Getting Host Name

You could use this function to get the UNC from a file.

Pass the workbook path to the function, and just strip the UNC from the
returned UNC path

Function GetUNCPath(myDriveLetter As String) As String
Dim lReturn As Long
Dim szBuffer As String

myDriveLetter = Left(myDriveLetter, 1) & ":"

szBuffer = String$(256, vbNullChar)
lReturn = WNetGetConnectionA(myDriveLetter, szBuffer, 256)

If lReturn = 0 Then
GetUNCPath = Left$(szBuffer, InStr(szBuffer, vbNullChar))
Else
GetUNCPath = "Error"
End If

End Function

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Delboy" wrote in message
...
Hi,

Does anyone know the VBA for getting the host name of a server (Windows
Server 2003) that an Excel spreadsheet (Excel 2003) is sitting on (I don't
mean path info, as I already know this and the host name doesn't show up).

I'm trying to set-up a trigger, so that if an Excel file is removed from

the
server onto someones PC the file will behave differently.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which hosting is better? Hostgater or seo-host Teahdeese Excel Discussion (Misc queries) 0 October 18th 08 05:13 AM
Top 10 Things To Look For In A Web Host best_hosting Excel Worksheet Functions 0 September 14th 08 03:01 PM
Host Session Emulation [email protected] Excel Worksheet Functions 0 December 27th 06 05:47 PM
host hospedagem profissional por 2,99 ao mês hostguia hospedagem dominio Charts and Charting in Excel 0 March 14th 05 11:18 AM
Convert IP Address to Host Name Ed Wurster Excel Programming 4 October 28th 04 01:14 PM


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"