CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Launch Excel

  1. #1
    Join Date
    Dec 2000
    Location
    Los Angeles, CA
    Posts
    34

    Launch Excel

    I have an Excel file located on a Windows95 share on a peer-to-peer network. I want to be able to open that file from the share so that when I use the following formula in Excel I see the networked path [i.e. "\\COMPUTERNAME\DIR\"]:

    =INFO("directory")

    So far everything I have tried I get some variation of "C:\My Documents\" even though the "Start-up" folder on the shortcut uses the networked path. I have tried every combination of .BAT files and .LNK files I can think of, but it ALWAYS has a local path.

    Does anyone know of a way to launch a file in Excel using a shortcut, and have the above formula display the networked path? Perhaps by using WSH or VB? Or better yet if anyone has an idea that would not require installing software to make it work [The PC this is needed for does not have WSH or VB runtime files].

    Any suggestions are appeciated.

    Nathan


  2. #2
    Join Date
    Apr 2000
    Location
    Southampton, UK
    Posts
    329

    Re: Launch Excel

    Nathan, you cannot do this satisfactorily with the Info worksheet function. My suggested method would be to include a VBA module either in a default template or in the workbook you are interested in with the following function.

    Function WorkingFolder() as string
    WorkingFolder = Application.ActiveWorkbook.Path
    End Function



    You can then use this to return the path correctly.

    TimCottee
    I know a little about a lot of things and a lot about very little.

    Brainbench MVP For Visual Basic
    http://www.brainbench.com

    MCP, MCSD, MCDBA, CPIM

  3. #3
    Join Date
    Dec 2000
    Location
    Los Angeles, CA
    Posts
    34

    Re: Launch Excel

    Okay... well your code works to get the directory including the computername the file is on... EXCEPT... I can't figure out how to have it evaluate it each time I launch the file. Any suggestions?


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured