We have a series of upgrade computers being installed. I have to install my application on these pc's, no problem but the install process is quite tricky if you're not used to the process.
The office pc's have one version where as the workshop pc's have a different package. Certain folders have to be created via code and docs pre-installed prior to the user using the application.
I've done this process many many times and have no problems.
I'm handing the installation over to our IT guys because I just don't have the time to commit.
So I'm creating an EXE which with one click of the button will install the version required for that particular pc and all necessary documents into the correct folders.
Now my question is, I can create the form with the commands buttons and using the shell command to execute each version, but it's the media to save the install package to.
I can save to a CD and the pc should see this as the D:\ drive or a memory stick which could be any combination of free drive letters.
So in my code obviously I can't use the specific drive letter !! Is there a default source path to use for all or any media? such as ( Guessing ) "application.path"..
Does anyone have any example code I can look at to give an idea?
Installing VB(6) exe application
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Installing VB(6) exe application
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Installing VB(6) exe application
Try
The variable strPath will return the folder in which the .exe is installed, with a trailing backslash, e.g. D:\ or E:\Install\. You can concatenate this with other strings or variables.
Code: Select all
Dim strPath As String
strPath = App.Path
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
End If
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 7218
- Joined: 15 Jan 2010, 22:52
- Location: Middle of England
Re: Installing VB(6) exe application
Could you have a setup.exe on the CD/DVD that runs on (CD) insertion and copies everything to the path of your choice - e.g. C:\Temp\... - runs the program install from there, then deletes the installation files?
Leif
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: Installing VB(6) exe application
Thanks guys for both options.
I've seen references to "App.Path" on many occasions but never really understood or had the need to investigate it properly.
I plan to have 4 folders:
CreateFolders
InstallWorkshop
InstallOffice
CopyDocs
All have different installation versions.
So if my code were something like:
Private Sub Command2_Click()
Dim strPath As String
Dim stAppName As String
strPath = App.Path
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
stAppName = strPath & "MM-Utilities\DW.exe"
Call Shell(stAppName, 1)
End If
Regardless what medium I put my install files on the drive letter is irrelevant ??
I've seen references to "App.Path" on many occasions but never really understood or had the need to investigate it properly.
I plan to have 4 folders:
CreateFolders
InstallWorkshop
InstallOffice
CopyDocs
All have different installation versions.
So if my code were something like:
Private Sub Command2_Click()
Dim strPath As String
Dim stAppName As String
strPath = App.Path
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
stAppName = strPath & "MM-Utilities\DW.exe"
Call Shell(stAppName, 1)
End If
Regardless what medium I put my install files on the drive letter is irrelevant ??
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Installing VB(6) exe application
App.Path will include the drive letter, so you don't need to worry about it.
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: Installing VB(6) exe application
Cheers Hans and Leif.
Very helpful.
Kind Regards
Very helpful.
Kind Regards
Cheers ...
Dave.
Dave.
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: Installing VB(6) exe application
Hans
Just testing the code you originally posted, it drills down and includes all folders.
I think for my purpose I only need the drive letter. The reason being I have four folders each with it's own setup.exe residing.
I can provide the folder path(s) in my application code, can we just return the application drive letter without the folders?
Just testing the code you originally posted, it drills down and includes all folders.
I think for my purpose I only need the drive letter. The reason being I have four folders each with it's own setup.exe residing.
I can provide the folder path(s) in my application code, can we just return the application drive letter without the folders?
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Installing VB(6) exe application
Yes:
Dim strDrive As String
strDrive = Left(App.Path, 1)
to get just the letter (D or F or ...), or
Dim strDrive As String
strDrive = Left(App.Path, 2)
to include the : after the drive letter (D: or F: etc.)
Dim strDrive As String
strDrive = Left(App.Path, 1)
to get just the letter (D or F or ...), or
Dim strDrive As String
strDrive = Left(App.Path, 2)
to include the : after the drive letter (D: or F: etc.)
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: Installing VB(6) exe application
Like:
Private Sub Command2_Click()
Dim strDrive As String
Dim stAppName As String
strDrive = Left(App.Path, 2)
stAppName = strDrive & "\Files\AnyFolder\SomeFolder\Setup.exe"
MsgBox stAppName
Call Shell(stAppName, 1)
End Sub
Giving me the option to change the stAppName path after strDrive ??
Regards
Private Sub Command2_Click()
Dim strDrive As String
Dim stAppName As String
strDrive = Left(App.Path, 2)
stAppName = strDrive & "\Files\AnyFolder\SomeFolder\Setup.exe"
MsgBox stAppName
Call Shell(stAppName, 1)
End Sub
Giving me the option to change the stAppName path after strDrive ??
Regards
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England