VBA code (1 Viewer)

wassim99

New member
Local time
Yesterday, 23:09
Joined
Oct 11, 2012
Messages
5
Hello All,
I am new to the site and to programming in general. I am writing this code in VBA studio 2010 and wanted a certain function out of it. I built a menu and want to set the code in a way that will close the application after I click on the button so for example if I want to click on the specific toolstrip menu item I want the application to take me to the destination but close at the same time. this is the code for one button that I have put together.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
IO.
File.WriteAllBytes(IO.Path.GetTempPath + "HOME.PDI", My.Resources.Home)
End Sub
Private Sub ToolStripMenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem10.Click
Process.Start("C:\Documents and Settings\wassim99\Desktop\homework1.doc")
End Sub

I tried close.me and it killed the application I think it closed it right after it started.
I know I have to link a close function with the click so the click will have 2 jobs, 1 take me to destination and then close application, but I dont know how to put it together.

thanks for the help all i appreciate it.
 

mdlueck

Sr. Application Developer
Local time
Today, 00:09
Joined
Jun 23, 2011
Messages
2,631
I am writing this code in VBA studio 2010 and wanted a certain function out of it. I built a menu and want to set the code in a way that will close the application after I click on the button

The way to exit the current Access application (so Access instance and the current database the form is in \ has the button, etc...) is as follows:

Code:
  'Close all of Access... bye bye now bye bye!!
  DoCmd.Quit

So spawn your other process, once that is done, issue this to completely exit Access.
 

wassim99

New member
Local time
Yesterday, 23:09
Joined
Oct 11, 2012
Messages
5
Sorry All, I am still trying to understand how the site works.
Thanks mdlueck for the reply. It didnt work tho, I guess it'll work in an access code.
Another thing I was thinking about in addition to the top question; would it be possible to build a button right next to the start menu that includes the above code, so I push the button there my menu pups up like a drop down for that button then I click on the desired destination, the code takes me there and closes.

Thanks again all
 

wassim99

New member
Local time
Yesterday, 23:09
Joined
Oct 11, 2012
Messages
5
Thanks for everything all,
I just added a close() at the end of the click command and it worked fine.
thanks for the input
Wassim
 

Users who are viewing this thread

Top Bottom