Opening a menu.exe file from a form - please help me :-)

G

gravesen

HI all I have a little problem and would like to hear if anyone of yo
can help me.

I have a documents opening a forn as the first thing. I would to fil
this for with data and when I then press the ok button I would like t
open a small menu.exe program.

Dim RetVal
RetVal = Shell("C:\WINDOWS\System32\CALC.EXE", 1)

I can open this using the following code but my problem is that thi
only works if I have the complete path. I wan't to run the hole thin
from a cd-rom and therefore I don't know the exact path. I have thi
other I am using to open another dot file through the first dot file.
am using this code for this:

Dim letterofenquiry As Object
Set letterofenquiry = CreateObject("word.application")
letterofenquiry.Documents.Add ThisDocument.Path & "\"
"letter_enquiry.dot"
letterofenquiry.Visible = True

Can I use a little of the codes to get what I want or do you know
way??

BTW this is the code I am using for the form.
Any Help is so grat :)

Private Sub cmdOK_Click()

Dim strSenderAddress As String
If cbovalgatt.Value = "Dear Sir," Then
TXTATT = "Yours faithfully,"
End If
If cbovalgatt.Value = "Dear Madam," Then
TXTATT = "Yours faithfully,"
End If
If cbovalgatt.Value = "Dear Mr Jones," Then
TXTATT = "Yours sincerely,"
End If
If cbovalgatt.Value = "Dear Sirs," Then
TXTATT = "Yours faithfully,"
End If
If cbovalgatt.Value = "Mesdames," Then
TXTATT = "Your faithfully,"
End If

If cboatt1.Value = "Direktør" Then
TXTATT1 = "For the attention of the Managing Director"
End If
If cboatt1.Value = "Indkøbschef" Then
TXTATT1 = "For the attention of the Purchasing Manager"
End If
If cboatt1.Value = "Filialchef" Then
TXTATT1 = "For the attention of the Branch Manager"
End If
If cboatt1.Value = "Salgchef" Then
TXTATT1 = "For the attention of the Sales Manager"
End If
If cboatt1.Value = "Regnskabschef" Then
TXTATT1 = "For the attention of the Acounts Manager"
End If
If cboatt1.Value = "Logistikchef" Then
TXTATT1 = "For the attention of the Dispatch Manager"
End If

If cbostilling.Value = "Direktør" Then
TXTATT2 = "Managing Director"
End If
If cbostilling.Value = "Indkøbschef" Then
TXTATT2 = "Purchasing Manager"
End If
If cbostilling.Value = "Filialchef" Then
TXTATT2 = "Branch Manager"
End If
If cbostilling.Value = "Salgchef" Then
TXTATT2 = "Sales Manager"
End If
If cbostilling.Value = "Regnskabschef" Then
TXTATT2 = "Acounts Manager"
End If
If cbostilling.Value = "Logistikchef" Then
TXTATT2 = "Dispatch Manager"
End If



Application.ScreenUpdating = False
With ActiveDocument

.Bookmarks("afsenderadresse").Range.Text
txtafsenderadresse.Value
.Bookmarks("afsenderwww").Range.Text = txtafsenderwww.Value
.Bookmarks("afsenderemail").Range.Text
txtafsenderemail.Value
.Bookmarks("valgatt").Range.Text = cbovalgatt.Value
.Bookmarks("afsendertlf").Range.Text = txtafsendertlf.Value
.Bookmarks("afsenderfax").Range.Text = txtafsenderfax.Value
.Bookmarks("modtageradresse").Range.Text
txtmodtageradresse.Value
.Bookmarks("navn").Range.Text = txtnavn.Value
.Bookmarks("cc").Range.Text = txtcc.Value
.Bookmarks("enc").Range.Text = txtenc.Value
.Bookmarks("valgatt1").Range.Text = TXTATT.Value
.Bookmarks("deresref").Range.Text = txtderesref.Value
.Bookmarks("voresref").Range.Text = txtvoresref.Value
.Bookmarks("fortheatt").Range.Text = TXTATT1.Value
.Bookmarks("stilling").Range.Text = TXTATT2.Value
End With


Application.ScreenUpdating = True
Unload Me
Dim RetVal
RetVal = Shell("C:\lars\easyletters\Breve\menuen.exe", 1)
End Su
 
G

grep

It sounds like you do know the path; you just don't know the drive
letter. In that case, you could probably set a field or input box
somewhere, for the user to input the drive letter used by their CD ROM,
and then have your VBA code look something like:

dim RetVal
dim DriveLetter

DriveLetter = InputBox "Please enter the drive letter for your CD ROM
drive: ",

RetVal = Shell(DriveLetter & "\WINDOWS\System32\CALC.EXE, 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top