The code you have goes with a form (dialog box) You need to design the form
with three command buttons on it and name them to match the code. Example:
CommandButton1 to run the sub CommandButton1_Click. Then I would add a sub
like so
Public Sub Main()
UserForm1.Show;;; Userform1 would be the name of your form
End Sub
Now your macro to show the dialog to allow you to click on a button would
be:
^C^C-vbarun "V:/VBA/excel_launch.dvb!Main"
Murph
--
http://mappingitout.blogspot.com/
wrote in message news:
[email protected]...
Murph, Thanks for your reply.
First, I have the VBA written and saved; it is a rather simple VBA that was
in a tutorial that I found on this site. I am simply trying to understand
how to call the VBA program now by assigning the proper text into a custom
button's command line.
Second, in looking at my VBA code, where can I find the sub routine's name?
(If I could just learn these 2 things, I can really take off; I am pretty
good at learning things and being able to piece things together to get what
I need) Here is the code;
Option Explicit
Private Sub CommandButton1_Click()
Dim excelapp As Excel.Application
Dim wbkobj As Workbook
Dim shtobj As Worksheet
On Error Resume Next
excel_launch.Hide
Err.Clear
Set excelapp = GetObject(, "excel.application")
If Err 0 Then
Err.Clear
Set excelapp = CreateObject("excel.application")
If Err 0 Then
MsgBox "Could not start Excel", vbExclamation
End
End If
End If
excelapp.Visible = True
Set wbkobj = excelapp.Workbooks.Add
Set shtobj = excelapp.worsheets(1)
excel_launch.Show
End Sub
Private Sub CommandButton2_Click()
Dim excelapp As Excel.Application
On Error Resume Next
excel_launch.Hide
Err.Clear
Set excelapp = GetObject(, "excel.application")
If Err 0 Then
Err.Clear
MsgBox "No Excel session running.", vbExclamation
End If
excelapp.Quit
excel_launch.Show
End Sub
Private Sub CommandButton3_Click()
End
End Sub
Private Sub UserForm_Click()
End Sub