Results 1 to 20 of 97

Thread: Solved: Only running MyExcel.xls on named machine?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Site Admin VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,008
    Location
    Matt, i dont have the Cmd facility on my machine (admin only) and i have no idea how our servers are set up, i did try sending "Net view" to my machines desktop but to no avail, nice suggestion with the cdo but there is that problem of manually inputting the captured data into a file.

    Ken, your suggestion sounds great, thats the mix of the both things i wanted....only able to use the workbook in its network location, and only the users specified at the specified machines, is this how i would do that?
    Sub CollectNames()
        Dim CN, UN
        Dim nRow, nRow1 As Long
        nRow = Sheets("Sheet1").Range("A65336").End(xlUp).Row + 1
        nRow1 = Sheets("Sheet1").Range("B65336").End(xlUp).Row + 1
        Set CN = Environ("ComputerName")
        Set UN = Environ("UserName")
        Workbooks.Open ("C:\Documents and Settings\vrtSzL04\Desktop\Names Test.xls")
        nRow = UN
        nRow1 = CN
        Workbook.Save
        Workbooks("C:\Documents and Settings\vrtSzL04\Desktop\Names Test.xls").Close
    End Sub
    i get a type mismatch error with Set Cn...etc could you explain why?. As i have said previously im still learning along the way and sometimes its a little difficult to decipher what you guys put together...but as ever i'm trying!

    "Very" my mum says!

    Regards,
    Simon
    Last edited by Aussiebear; 03-11-2025 at 05:47 PM.
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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