PDA

View Full Version : Solved: Open excel, access, and power point



B18DelSolT
09-03-2007, 06:44 AM
Hello everyone, i just wanna start saying that im a total noob when it comes to vba, but most deff willing to learn it.

I am working on a school project 4 word, 4 excel, 4 access, and 1 power point presentation.

I was wondering if i could creat command buttons in power point so that when you click it, it will open a specific excel workbook, chart or a specific access table, form, report, and also to opwn my power point presentation

I got it to work with word only and thats it, this has been driving me up the wall since i was told i could do this little extra credit thing. all i wanna do right now is :banghead: lol thats how aggrivated i have been getting.

All help would be greatly appreciated

Thanks much
Nel

B18DelSolT
09-18-2007, 10:50 PM
I got it to work with the help of my teacher,

What i did was under power point i create a button under Intsert, Shapes, Action buttons.

After that under mouse click, i would select run program Which was access, and then direct it to where the file i need to open is.after that i create a command parameter.

"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE" "F:\School\Access\CompanyDatabase.accdb" \cmd 0

thats how i put it in the box

Thats how you would get it just to open any program with file through powerpoint.

I went a little further. What i wanted to do with this is to open each table, form, report that i wanted to view.

Now under access i created w.e. you wanna call it lol (noob here)
to direct access to open each thing when ever that command was ran, how i did it was i created a blank form, enterd that new form in design view then created a button. when the button was created i right clicked, and on the submenu i clicked build event, then under choose builder clicked code builder.

once vba opened i deleted everything in there and enterd this
Private Sub Form_Load()

If Command = "0" Then
DoCmd.OpenTable "Customer"
ElseIf Command = "1" Then
DoCmd.OpenTable "Employee"
ElseIf Command = "2" Then
DoCmd.OpenTable "Products"
ElseIf Command = "3" Then
DoCmd.OpenForm "Customer"
ElseIf Command = "4" Then
DoCmd.OpenForm "Employee"
ElseIf Command = "5" Then
DoCmd.OpenForm "Products"
ElseIf Command = "6" Then
DoCmd.OpenReport "Employee", acViewPreview
Else
End If
End Sub

after doing that i created a macro named AutoExec to run Form1.

Im almost 99% positive that 85% of the people in here wont understand what i just posted, but if someone does, can they post it in a clearer manner cause i cant explain things for my life.

But thats how i got it to work.

B18DelSolT
09-19-2007, 04:45 PM
To open Excel, all i did was creat a commandbutton


Private Sub CommandButton1_Click()
'OpenAExcelDoc()
Dim exapp As Object, exwrkbook As Object
Set exapp = CreateObject("Excel.Application")
exapp.Workbooks.Open "E:\School\Excel\Net Income.xlsx"
exapp.Visible = True
End Sub