Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting Server Host Name (Excel 2003)

    Hi,

    Does anyone know the VBA for returning the Host name of a server (Windows server 2003) from an Excel 2003 spreadsheet running on that server?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Getting Server Host Name (Excel 2003)

    You could check the Path property of the workbook.
    If it starts with , the path is an UNC path, and you can extract the server name as the part between and the next .
    Otherwise, the path uses a drive letter. You can use various methods to translate a drive letter to an UNC path, for example see <post:=453,960>post 453,960</post:>.

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting Server Host Name (Excel 2003)

    Thanks, but the path info doesn't help me as I already know this. What I'm after is the actual name of the host server (this doesn't appear in the path information in my case, as the server is set-up to act like a desktop from Excels point of view).

    When I have the name via VBA I can do some verification, and if a user takes a file off the server the Excel file will behave differently once it can't find the server etc.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Getting Server Host Name (Excel 2003)

    I'm sorry, I cannot help you with that. It's certainly not an Excel question!

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Getting Server Host Name (Excel 2003)

    Can you just clarify something: is the Excel application processing the workbook running on the server too, or is the workbook simply hosted on the server?
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting Server Host Name (Excel 2003)

    The Excel application (on the server) is processing the workbook i.e. its a Terminal Services environment, so it feels to a user like its their desktop, but everything is processed on the server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •