# Visual Basic 6 help



## puma99dk| (Jul 5, 2013)

i am trying to make a custom menu or what u will call it, for work so i can combined Office 2013 OEM Danish and English 32bit onto on disc it looks like this:







and i use this code in the:


```
Private Sub Command1_Click(Index As Integer)
Shell "C:\Office 2013 DAN-ENG\DA-da\setup.exe"
End Sub

Private Sub Command2_Click()
Shell "C:\Office 2013 DAN-ENG\EN-en\setup.exe"
End Sub
```


i want it to excuse the original setup.exe for Office 2013 32bit in the folder path, when it's burned out the path will ofc be "\DA-da\setup.exe" and "\EN-en\setup.exe" if i am not wrong.

can anyone tell me what i am doing wrong, bcs when i click on the buttons atm i get this message:


----------



## FordGT90Concept (Jul 5, 2013)

Remove "C:\Office 2013 DAN-ENG" from the path?


----------



## puma99dk| (Jul 5, 2013)

that leads to this:






to make it clear, i am not a Visual Basic expert, this is my first day using this program x:


----------



## Aquinus (Jul 5, 2013)

I would use something newer. VB 6 is pretty old. You should be able to get the latest express edition of Visual Basic .NET off Microsoft's website. You should use something like that instead IMHO. Personally, I would use C# if I was going to develop for Windows but, that's me.

http://www.microsoft.com/visualstudio/eng/downloads#d-2012-express


----------



## puma99dk| (Jul 5, 2013)

Aquinus said:


> I would use something newer. VB 6 is pretty old. You should be able to get the latest express edition of Visual Basic .NET off Microsoft's website. You should use something like that instead IMHO. Personally, I would use C# if I was going to develop for Windows but, that's me.
> 
> http://www.microsoft.com/visualstudio/eng/downloads#d-2012-express



i need to be able to run this even without having C++ installed, dunno if Visual Basic is the thing to use then or not. This here is kinda of my own project at work i have started...


----------



## FordGT90Concept (Jul 5, 2013)

Try just "EN-en\setup.exe"


----------



## puma99dk| (Jul 5, 2013)

FordGT90Concept said:


> Try just "EN-en\setup.exe"





> Private Sub dansk_Click()
> Shell "DA-da\setup.exe"
> End Sub
> 
> ...



not working either so i dunno


----------



## GSquadron (Jul 5, 2013)

Try it like this """C:\Office 2013 DAN-ENG\DA-da\setup.exe""" for both


----------



## puma99dk| (Jul 5, 2013)

with 3x """ in front and back?


----------



## Aquinus (Jul 5, 2013)

Backslashes need to be escaped iirc. It should look like:

"C:\\Directory\\to\\some\\path\\file.exe"


----------



## puma99dk| (Jul 5, 2013)

Aquinus said:


> Backslashes need to be escaped iirc. It should look like:
> 
> "C:\\Directory\\to\\some\\path\\file.exe"



then i get:

View attachment 51764


----------



## GSquadron (Jul 5, 2013)

puma99dk| said:


> with 3x """ in front and back?



Yes


----------



## puma99dk| (Jul 5, 2013)

Aleksander said:


> Yes



still don't work :/

but i think it's may be the setup file i am using to be honest.

bcs i just tried another setup.exe file and it starts perfectly.


----------



## puma99dk| (Jul 5, 2013)

so now i need to find away to make it run from ISO file, bcs if i type C:\blahblah\blahblah\setup.exe it will search the hdd not the iso file :/


----------



## GSquadron (Jul 5, 2013)

Found this similar prob, maybe it will help. That's why the 3x "
http://www.ozgrid.com/forum/showthread.php?t=50453
Maybe remove the spaces from the filename and rename the folder


----------



## FordGT90Concept (Jul 5, 2013)

puma99dk| said:


> not working either so i dunno


That should have worked assuming the executable is running from the directory above them both (at C:\Office 2013 DAN-ENG\APP.EXE).  Visual Studio may be executing from a location you're not expecting it to be executing from.


Edit: I would recommend "burning" to an ISO, then mounting the ISO to test.  Don't waste a disk until you're sure it works.


Edit: It may also help to set the working directory when launching the executable.  Relative paths are based on the working directory.


----------



## BiggieShady (Jul 8, 2013)

puma99dk| said:


> View attachment 51764
> 
> View attachment 51765



I believe the first picture shows error message from the setup.exe, and second is the error message from the Project1. So the shell command works, only installer throws error.


----------



## Mindweaver (Jul 8, 2013)

Try this _C:\Office%2013%DAN-ENG\DA-da\setup.exe_ or _"C:\Office%2013%DAN-ENG\DA-da\setup.exe"_


----------



## okidna (Jul 8, 2013)

Try :


```
Private Sub Command1_Click(Index As Integer)
Shell "\Office 2013 DAN-ENG\DA-da\setup.exe"
End Sub
```

or :


```
Private Sub Command1_Click(Index As Integer)
Shell """\Office 2013 DAN-ENG\DA-da\setup.exe"""
End Sub
```


----------



## puma99dk| (Jul 8, 2013)

well i need to get it to run from a ISO file so i don't need "C:\Office 2013 DAN-ENG\"


----------



## Mindweaver (Jul 8, 2013)

puma99dk| said:


> well i need to get it to run from a ISO file so i don't need "C:\Office 2013 DAN-ENG\"



Ahh ok... When using shell and you want to find out where a file lives then use "_%~dp0_". 

Try this code


```
Private Sub Command1_Click(Index As Integer)
Shell "%~dp0\DA-da\setup.exe"
End Sub

Private Sub Command2_Click()
Shell "%~dp0\EN-en\setup.exe"
End Sub
```

*EDIT: In VB6 you can do this: 
	
	




		Code:
	

App.Path & IIf(Right$(App.Path, 1) <> "\", "\", "") & App.EXEName & ".exe"

 So, you would need to do 
	
	




		Code:
	

App.Path & IIf(Right$(App.Path, 1) <> "\", "\", "") & "DA-da\setup.exe"



Here is how I would use it.

Example:


		Code:
	

[/B]Private Sub Command1_Click()

Dim drive As String
drive = App.Path & IIf(Right$(App.Path, 1) <> "\", "\", "") & "DA-da\setup.exe"

Shell "cmd /C " & drive, vbNormalFocus
Shell "Taskkill /IM cmd.exe"

End Sub

*


----------



## FordGT90Concept (Jul 8, 2013)

Alternatively, you could just make the application with VB.NET, make a setup for it that includes the .NET installer, and use autorun.inf to point to the setup.

Windows Vista and newer have at least .NET Framework 2.0 preinstalled.  Only XP and older don't have .NET unless the user opt'd in for it at Windows Update.


----------



## Mindweaver (Jul 8, 2013)

FordGT90Concept said:


> Alternatively, you could just make the application with VB.NET, make a setup for it that includes the .NET installer, and use autorun.inf to point to the setup.
> 
> Windows Vista and newer have at least .NET Framework 2.0 preinstalled.  Only XP and older don't have .NET unless the user opt'd in for it at Windows Update.



Yea I agree, VB.net would be more ideal than vb6.


----------



## puma99dk| (Jul 9, 2013)

which VB version? 2010 or 2012? bcs i can get Visual Basic 2010 / 2012 Express...


----------



## Mindweaver (Jul 9, 2013)

puma99dk| said:


> which VB version? 2010 or 2012? bcs i can get Visual Basic 2010 / 2012 Express...



It depends.. If you need your program to work on Windows XP or later then 2010. If not then 2012. I have 2012 installed on one of my Windows 8 boxes, but I don't use it as much. Did you not try what I suggested above? I have Visual Studio 6 on a VM. So, I loaded up the VM and tested my code above and it works. I'm with Ford and think you should move over to .net, but your transition my take a week or two. If you need this to work now, then I would suggest you finish this project in VB6. Once you get the hang of .net then re code it in .net.


----------



## puma99dk| (Jul 9, 2013)

but thx FordGT90Concept, Mindweaver and all the others, i build it up in VB.net 2010 Express.

i got title and icon in the window










and atm i got the same message on the danish installation bcs 2,58gb of free space on my ssd in my dad's laptop ^^;


----------



## Mindweaver (Jul 9, 2013)

puma99dk| said:


> but thx FordGT90Concept, Mindweaver and all the others, i build it up in VB.net 2010 Express.
> 
> i got title and icon in the window
> 
> ...



Nice!  Now burn your vb6 disc.. lol naw j/k I still have to use it on occasions for some companies, but I'm slowly convincing them to let me update there code to .net.


----------



## puma99dk| (Jul 9, 2013)

Mindweaver said:


> Nice!  Now burn your vb6 disc.. lol naw j/k I still have to use it on occasions for some companies, but I'm slowly convincing them to let me update there code to .net.



i made it as an iso so far and installing from that works fine ^^


----------



## Mindweaver (Jul 9, 2013)

puma99dk| said:


> i made it as an iso so far and installing from that works fine ^^



I meant burn as in pour gas on your vb6 disc, and catch it on fire because .net is so much better... lol  I was just joking though...


----------



## puma99dk| (Jul 9, 2013)

Mindweaver said:


> I meant burn as in pour gas on your vb6 disc, and catch it on fire because .net is so much better... lol  I was just joking though...



oh, nah it was digital download so no cd to burn


----------

