Results 1 to 5 of 5

Thread: Path of current working directory

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    5

    Path of current working directory

    Hello all,

    I have published and made a executable file of visual basic code. While installing that .exe file in another computer, I want to copy paste an "Excel workbook" in the folder where .exe is installed .
    This is required because while running the code I have to pick the data from that excel.

    Is it possible somehow that during installation of .exe, "Excel workbook " can be reached to that folder

    It will be a great help for me.

    Thanks in advance

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,043

    Re: Path of current working directory

    Yeah, you could do it, but you shouldn't do it. The .exe would normally be installed in the Programs folder, which is a restricted location. There are special folders in Windows, some of which would be much more appropriate, and all of which can be obtained more easily. Take a look at this link:

    https://msdn.microsoft.com/en-us/lib...v=vs.100).aspx
    My usual boring signature: Nothing

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,206

    Re: Path of current working directory

    It will depend on how you are deploying the application. Are you creating an Install package? If so, what tool are you using, most of them will let you add files to your setup program. I know ClickOnce lets you add files.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    5

    Re: Path of current working directory

    Hi yes I am using "ClickOnce" to open it, But I am not able understand how to give variable path for my excel.
    Actually I am using network connected computers where in drive name changes frequently
    hence I cant use any fixed path.
    I am looking for a solution for dynamic path and how to add my excel to dynamic path

    Thanks in advance

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,043

    Re: Path of current working directory

    Those special folders are only special in that they shouldn't be changing any. I still think that's the best approach, and you can certainly do that, but if you are using ClickOnce deployment, some of what I said wasn't quite correct. The .exe location for a ClickOnce deployed app is....deep. It's located somewhere nearly random. You could package the spreadsheet with the application and it will end up at a hidden, but still accessible place. I actually have an example of that, I just can't get to it from the computers I have available to me now. What you can't do is copy and paste the spreadsheet AFTER the deployment has happened. It wouldn't be technically impossible, it would just be a total nightmare. You could only copy and paste reasonably by using one of those special folder locations. If you want to deploy the spreadsheet, you can do that, BUT you can't expect anybody to get to the spreadsheet outside of your program, in which case a spreadsheet doesn't make sense.

    The example I could provide (eventually) was a case where I packaged an empty mdb database along with an application. When the application runs, it checks a specific folder to see whether a certain mdb is found there, and if it is not, it copies that empty mdb into that location. In other words, I'm publishing something (an excel file would work just the same as an mdb) along with the application, but it isn't USED where it is published, it is only used as a template that gets copied to a target location as needed. If that would work, then I could show an example. However, I still think the special locations are better. I should have used them myself....but that was a different age, with different expectations.
    My usual boring signature: Nothing

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