Excel VBA (Copy / Paste To Another Application)

I have copied a range of durations, start dates and finish dates from excel to the office clipborad in excel vba.

I have then used a hyperlink function to jump into an MS project file.

    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

How can i past the contents of the office clipboard into my project file.

Your support will be greatly appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The only way I think you can do this is to create an instance of MS Project within the Excel VBA.

You would set it as something like:  

Dim objProj as Object
Set objProj  = CreateObject("Project.Application")
With o
'do your automation stuff here
'guessing something like o.tasks.paste.......etc
End With
'Close the object

not sure what the correct syntax is for opening project so just guessed the Project.Application bit

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerCommented:
Try this routine instead

Sub copytomsp()
Set msp = GetObject(, "MSProject.Application")
End Sub
Saqib Husain, SyedEngineerCommented:
Sorry, wobbled. Did not see your post. The page was opened for a long time without refresh

HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

not a problem Saqib - I do that all the time :)
SweetingAAuthor Commented:
I will accpet the solution, it works fine thanks

Just one more question first - is it possible to specify where the data will be pasted like in excel (i.e. cell range)

Saqib Husain, SyedEngineerCommented:
Yes it is. But I do not know how. I might be able to find ways but not such that I can define it here. I suggest that you make trials with the macro recorder in MSProject. That is where I got the code from.

SweetingAAuthor Commented:
ok, good idea
Saqib Husain, SyedEngineerCommented:
Hello there. Are you sure you accepted the appropriate solution. I think I provided you with a working solution whereas the accepted solution was merely a guideline. Did you use my solution to achieve what you wanted or the first one?
Saqib Husain, SyedEngineerCommented:
The accepted solution should be

ssaqibh #33444081

See http://www.experts-exchange.com/Q_26426940.html

I disagree. Wobbled posted the solution first (which ssaqibh acknowledges). There is EVERY reason to think the follow-up was intended for Wobbled, and ssaqibh responded -- but that doesn't mean that the Asker's selection should be overturned.

Saqib Husain, SyedEngineerCommented:
Ok I give up. But I still maintain that "works fine" referred to my solution.

Thanks for taking the time.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.