Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel VBA (Copy / Paste To Another Application)

Posted on 2010-08-15
12
Medium Priority
?
513 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 2000 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
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.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

971 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