Solved

Excel VBA (Copy / Paste To Another Application)

Posted on 2010-08-15
12
436 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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;…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now