Microsoft Project Member for 18 years 4 months Member for 18 years 5 months Submitted by Brian Ultican on Tue, 2007-06-12 12:12 Permalink RE: Custom Button I dont know what to say. It worked fine for me on two different machines. Member for 23 years Member for 23 years Submitted by Hemanth Kumar on Tue, 2007-06-12 06:03 Permalink RE: Custom Button Unfortunately Your Code Does Not Works Here is the working way Create a custom button Press Alt F11 select "this project" insert "new Module in that module Cut and paste the following code ---------------------------------------------------------------- Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub RunYourProgram() Dim RetVal As Long On Error Resume Next RetVal = ShellExecute(0, "open", "C:\Documents and Settings\planner\My Documents\0Essentials\GRAFICS for MSP.xls", "", _ "C:\MASTER", SW_SHOWMAXIMIZED) End Sub ------------------------------------------------------------------------------------------------------------------------ were "C:\MASTER" MASTER is a blank folder in my computer and "GRAFICS for MSP.xls" is the file to be opened Rename the module , should not be like module1, etc give any name now save this module to GLOBAL.mpt now -assign "RunYourProgram" macro to the button it works Code Courtsey ::::::: michael@suodenjoki.dk Thanks hemant Member for 23 years Member for 23 years Submitted by Hemanth Kumar on Mon, 2007-06-11 06:25 Permalink RE: Custom Button Thanks I l ll have a try Member for 18 years 4 months Member for 18 years 5 months Submitted by Brian Ultican on Sun, 2007-06-10 22:04 Permalink RE: Custom Button Assign the VBA macro below to a new button Sub OpenAttendance() Dim xlapp As Object Set xlapp = CreateObject("excel.Application") xlapp.Workbooks.Open FileName:="C:\Data\Attendance.xls" xlapp.Visible = True End Sub Log in or register to post comments
Member for 18 years 4 months Member for 18 years 5 months Submitted by Brian Ultican on Tue, 2007-06-12 12:12 Permalink RE: Custom Button I dont know what to say. It worked fine for me on two different machines.
Member for 23 years Member for 23 years Submitted by Hemanth Kumar on Tue, 2007-06-12 06:03 Permalink RE: Custom Button Unfortunately Your Code Does Not Works Here is the working way Create a custom button Press Alt F11 select "this project" insert "new Module in that module Cut and paste the following code ---------------------------------------------------------------- Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub RunYourProgram() Dim RetVal As Long On Error Resume Next RetVal = ShellExecute(0, "open", "C:\Documents and Settings\planner\My Documents\0Essentials\GRAFICS for MSP.xls", "", _ "C:\MASTER", SW_SHOWMAXIMIZED) End Sub ------------------------------------------------------------------------------------------------------------------------ were "C:\MASTER" MASTER is a blank folder in my computer and "GRAFICS for MSP.xls" is the file to be opened Rename the module , should not be like module1, etc give any name now save this module to GLOBAL.mpt now -assign "RunYourProgram" macro to the button it works Code Courtsey ::::::: michael@suodenjoki.dk Thanks hemant
Member for 23 years Member for 23 years Submitted by Hemanth Kumar on Mon, 2007-06-11 06:25 Permalink RE: Custom Button Thanks I l ll have a try
Member for 18 years 4 months Member for 18 years 5 months Submitted by Brian Ultican on Sun, 2007-06-10 22:04 Permalink RE: Custom Button Assign the VBA macro below to a new button Sub OpenAttendance() Dim xlapp As Object Set xlapp = CreateObject("excel.Application") xlapp.Workbooks.Open FileName:="C:\Data\Attendance.xls" xlapp.Visible = True End Sub
Member for
18 years 4 monthsRE: Custom Button
I dont know what to say. It worked fine for me on two different machines.
Member for
23 yearsRE: Custom Button
Unfortunately Your Code Does Not Works
Here is the working way
Create a custom button
Press Alt F11
select "this project"
insert "new Module
in that module
Cut and paste the following code
----------------------------------------------------------------
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub RunYourProgram()
Dim RetVal As Long
On Error Resume Next
RetVal = ShellExecute(0, "open", "C:\Documents and Settings\planner\My Documents\0Essentials\GRAFICS for MSP.xls", "", _
"C:\MASTER", SW_SHOWMAXIMIZED)
End Sub
------------------------------------------------------------------------------------------------------------------------
were "C:\MASTER" MASTER is a blank folder in my computer
and "GRAFICS for MSP.xls" is the file to be opened
Rename the module , should not be like module1, etc give any name
now save this module to GLOBAL.mpt
now -assign "RunYourProgram" macro to the button
it works
Code Courtsey ::::::: michael@suodenjoki.dk
Thanks
hemant
Member for
23 yearsRE: Custom Button
Thanks
I l ll have a try
Member for
18 years 4 monthsRE: Custom Button
Assign the VBA macro below to a new button
Sub OpenAttendance()
Dim xlapp As Object
Set xlapp = CreateObject("excel.Application")
xlapp.Workbooks.Open FileName:="C:\Data\Attendance.xls"
xlapp.Visible = True
End Sub