Solved

Excel VBA (Copy / Paste To Another Application)

Posted on 2010-08-15
12
490 Views
Last Modified: 2012-08-13
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.

    Range("C26:E80").Select
    Selection.Copy
    Range("B91").Select
    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.
0
Comment
Question by:SweetingA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
12 Comments
 
LVL 17

Accepted Solution

by:
wobbled earned 500 total points
ID: 33443978
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
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 33444081
Try this routine instead

Sub copytomsp()
Set msp = GetObject(, "MSProject.Application")
    Range("C26:E80").Select
    Selection.Copy
    msp.EditPaste
End Sub
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 33444087
Sorry, wobbled. Did not see your post. The page was opened for a long time without refresh

Saqib
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 17

Expert Comment

by:wobbled
ID: 33444125
not a problem Saqib - I do that all the time :)
0
 

Author Comment

by:SweetingA
ID: 33447705
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)




0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 33447836
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.

Saqib
0
 

Author Comment

by:SweetingA
ID: 33448636
ok, good idea
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 33448738
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?
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 33495686
The accepted solution should be


ssaqibh #33444081
0
 
LVL 5

Expert Comment

by:Netminder
ID: 33528383
coolleomod,

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.

Netminder
0
 
LVL 43

Expert Comment

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

Thanks for taking the time.

Saqib
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question