HosseinReihai
New Member
- Joined
- Dec 30, 2015
- Messages
- 5
Hello All
I am Mohammad Hossein Reihani an Industrial Engineering student.
I want to find a way by which I can control a macro function which I have written in the MSP from Excel.
For example, I have a function which opens a specific mpp format file. the argument of the function is the address of that file in my computer and is what I want to be changed from Excel. I have tested this code:
[FONT=georgia, serif]Public Function GoProject(func As String)
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Opens Microsoft Project[/FONT]
[FONT=georgia, serif] Shell ("msproject.exe")[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Initiates a DDE channel to Microsoft Project[/FONT]
[FONT=georgia, serif] Chan = DDEInitiate("msproject", "system")[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Activates Microsoft Project[/FONT]
[FONT=georgia, serif] Application.<wbr>ActivateMicrosoftApp xlMicrosoftProject[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Runs the Project global macro "AdjustDates"[/FONT]
[FONT=georgia, serif] Application.DDEExecute Chan, "AdjustDates"[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Terminates the DDE channel[/FONT]
[FONT=georgia, serif] Application.DDETerminate Chan[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] End Function[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif]and changed the red color macro name with my desired function , which has been written in msp:[/FONT]
[FONT=georgia, serif]
[/FONT]
[FONT=georgia, serif]Function OpenProjFile(address As String)
FileOpenEx Name:=address, ReadOnly:=False, FormatID:="MSProject.MPP"
End Function
but it does not work. must declare an object or a string ( I wrote: "OpenProjFile(address)" where address is "C:\temp\myproject.mpp")
I would be glad if you could give me some advice.
Al the best and happy new year,
Hossein
[/FONT]
[/FONT]
I am Mohammad Hossein Reihani an Industrial Engineering student.
I want to find a way by which I can control a macro function which I have written in the MSP from Excel.
For example, I have a function which opens a specific mpp format file. the argument of the function is the address of that file in my computer and is what I want to be changed from Excel. I have tested this code:
[FONT=georgia, serif]Public Function GoProject(func As String)
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Opens Microsoft Project[/FONT]
[FONT=georgia, serif] Shell ("msproject.exe")[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Initiates a DDE channel to Microsoft Project[/FONT]
[FONT=georgia, serif] Chan = DDEInitiate("msproject", "system")[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Activates Microsoft Project[/FONT]
[FONT=georgia, serif] Application.<wbr>ActivateMicrosoftApp xlMicrosoftProject[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Runs the Project global macro "AdjustDates"[/FONT]
[FONT=georgia, serif] Application.DDEExecute Chan, "AdjustDates"[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] 'Terminates the DDE channel[/FONT]
[FONT=georgia, serif] Application.DDETerminate Chan[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif] End Function[/FONT]
[FONT=georgia, serif][/FONT]
[FONT=georgia, serif]and changed the red color macro name with my desired function , which has been written in msp:[/FONT]
[FONT=georgia, serif]
[/FONT]
[FONT=georgia, serif]Function OpenProjFile(address As String)
FileOpenEx Name:=address, ReadOnly:=False, FormatID:="MSProject.MPP"
End Function
but it does not work. must declare an object or a string ( I wrote: "OpenProjFile(address)" where address is "C:\temp\myproject.mpp")
I would be glad if you could give me some advice.
Al the best and happy new year,
Hossein
[/FONT]
[/FONT]