Solved

Excel VBA (Copy / Paste To Another Application)

Posted on 2010-08-15
12
448 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net dynamic formulas in runtime 11 63
Excel 2016 Not Responding Issues 6 28
Copy value from a certain cell 5 24
Need quick fix on defining a variable 5 15
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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 …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

896 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

15 Experts available now in Live!

Get 1:1 Help Now