# create exe to install xls file to xlstart



## ratt2581 (Mar 26, 2008)

at work we have a macro sheet that is shared through multiple users so anytime its updated we send it out and they have to save it over in their c:\Documents and Settings\USERNAME\Application Data\Microsoft\Excel\XLSTART

now while this usually isnt a daunting task - some ppl have an issue and I was hoping someone could help me create (or steer me to some good websites) a standalone .exe file that would have the macro.xls spreadsheet inside it.

So all the users would have to do was double click the .exe file and it would automatically save the file to the right location and thus end anymore headaches.

I have access to visual studios and have familarity in a few different programming languages - just no experience using VS or building a .exe

Thanks for any potential help


----------



## Joe4 (Mar 26, 2008)

I did something like this for a split Access database.  Basically, the front end was on the Local Machines, but I often had updates, so I needed to ensure that they were automatically copied over the the Local Machines whenever someone tried to run them.

I did this with a simple DOS batch file.  All you need to do is enter the code in a text editor and save it with a .BAT extension.  Then whenever it is clicked on, it automatically runs.  So this is the shortcut I put on people's desktop.

Here is a simple example.  I will explain how it works:

```
echo off
::  CHECK FOR EXISTENCE OF NEWEST VERSION ON LOCAL MACHINE (currently v2)
IF EXIST "C:\Program Files\MyExcelFile_v2.xls" GOTO OPENXLSFILE

::  COPY NEWEST VERSION FROM NETWORK TO LOCAL MACHINE
del " C:\Program Files\MyExcelFile_v*.*"
copy "W:\MyExcelFile_v2.xls" "C:\Program Files\MyExcelFile_v2.xls"

:OPENXLSFILE
::  OPEN LOCAL COPY OF EXCEL FILE
"C:\Program Files\MICROSOFT OFFICE\OFFICE10\EXCEL.EXE" C:\Program Files\MyExcelFile_v2.xls

"C:\Program Files\MICROSOFT OFFICE\OFFICE11\EXCEL.EXE" C:\Program Files\MyExcelFile_v2.xls

"C:\Program Files\MICROSOFT OFFICE\OFFICE\EXCEL.EXE" C:\Program Files\MyExcelFile_v2.xls

EXIT
```
Basically, I save the Excel file with a version number after it.  So the first one ends in "v1".  The next time I need to change it, I save it with a "v2" after it, etc.

So what this macro does is first checks to see if the user has the most recent version of the Excel file copied to their Local Machine.  If they do not, then it first deletes the old version out there, then copies the new version from the Network Drive to the Local Machine.  It then opens the file from the Local Machine.  

Note that I have three different commands for opening the file.  The only difference is the Office directory (either Office, Office10, or Office11).  This is due to the fact that we have multiple different versions of Excel running in our office (97, 2000, 2002).  You only need to list the ones that your office is using.  You can determine this easily enough by browsing to these directories and seeing where the Excel application resides.  It does not hurt anything to have the extras out there.  Those attempts are simply errored out and bypassed, unknown to the user.

So the only thing you really need to do maintain this is:
- Create this .bat file and place it somewhere on the server and put shortcuts to this .bat file on people's desktops
- Keep a master copy of your must current version of your Excel file on the server
- As you make changes/updates to your Excel file, save the new version with a new version number and then update the batch file to reflect those changes.

And voila, everything else takes care of itself!


----------



## ratt2581 (Mar 26, 2008)

Thanks - we debated the batch file method but decided against because not everyone will always have access to the network location (I argued that it was too few a time to matter, but...)

The thought was an exe with the xls embedded in would always be available as long as ppl had access to their email.


----------



## Joe4 (Mar 27, 2008)

> not everyone will always have access to the network location


There isn't one common "share" drive at your work that everyone has access to (or you can give everyone access to)?

From your response, I am guessing not.  It just seems a little odd, especially if people are using the same programs.


----------



## ratt2581 (Mar 27, 2008)

Everyone has access to a common drive - just not all the time - unlike email


----------



## NdNoviceHlp (Mar 27, 2008)

This link might be of some interest to you. Good luck. Dave
http://www.mrexcel.com/forum/showthread.php?t=227700&highlight=vb6


----------

