Consulting

Results 1 to 3 of 3

Thread: Simple XL launcher exe.

  1. #1
    VBAX Regular
    Joined
    Aug 2004
    Location
    Manchester UK
    Posts
    16
    Location

    Simple XL launcher exe.

    Guys,

    I need a file that will launch a chosen Excel file. I will be using this on our citrix farm.

    I have a workbook with 2 columns. Column A contains the Project Name, Column B contains the path for that projects workbook.

    So, I need a small app that will give a list of project names, then when chosen and OK clicked, it will pass the relevant path to Excel and open it. Thats the easy bit, I think !

    I also need it to detect if the file is already open, and then disallow the read-only prompt. (This doesn't show in Citrix anyway for some reason, so the users are working on it concurrently.) So if the file is already open, show a message "This file is in use by UserName (from Excel)" Then it closes when OK is clicked. Only one user should have this file open at any one time.

    Could anybody give me a starter for 10 ?

    Cheers
    Bob

  2. #2
    VBAX Regular
    Joined
    Oct 2004
    Location
    Belgium
    Posts
    25
    Location
    Hi,

    see the code. I've used a form with a listbox and a button. Data starts to read at row 1. When you start the form, listbox is filled in. If you then select an item and execute the code of the button, you get a first result.

    I hope this gives you a first idea and a good start.
    To know which user a file has open is a little bit more work.(searched longtime myself)

    [VBA]
    Private Sub CommandButton1_Click()
    On Error GoTo FileNotOpen
    Workbooks.Open ActiveSheet.Cells(ListBox1.ListIndex + 1, 2).Value
    Exit Sub
    FileNotOpen:
    MsgBox "File doesn't exist!"
    End Sub

    Private Sub UserForm_Activate()
    Dim intRow As Integer

    'Start on row 1
    intRow = 1
    Do While ActiveSheet.Cells(intRow, 1).Value <> ""
    ListBox1.AddItem ActiveSheet.Cells(intRow, 1).Value
    intRow = intRow + 1
    Loop
    End Sub
    [/VBA]


    Gollem

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi Bob,

    Have you seen this link ... ?

    http://www.vbaexpress.com/forum/showthread.php?t=1190

    I haven't quite got the procedure worked out for myself yet (retreiving the username portion), but Ivan lines it out on his website (link provided in first post) and there is some excellent discussion on the XtremeVB talk website (link also provided) by Mike, Ivan, Mark and Helen. There is an API version and a VBA version. This does what you are asking for.

Posting Permissions

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