cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Automating copy and paste through VB

Highlighted

Automating copy and paste through VB

Good morning all!

I have a question for all of you VB-savvy programers out there that work with MathCAD...

What I would like to do is this: Automate copying and pasting on a sheet-by-sheet basis in MathCAD into a MS Word document. Basically, all I want the user to do is to specify the particular sheet where the MathCAD pages are to be pasted in. One more thing: I would like for the pasted pages to be pasted links via the paste special in Word. That way, if I change any current text or images in the MathCAD document in the future, all I would need to do is to right click and update the links.

I have already figured out the details concerning having the user select the right MathCAD file they wish to use and have VB open up the document through Word. Im also familiar with getting the user to input the page numer they wish to start pasting the linked pages.

I am pretty much locked in with my choices concerning what programs I can use, so I would really appreciate any feedback on this and whether or not its even possible. Thanks in advance!

12 REPLIES 12
Highlighted

Re: Automating copy and paste through VB

BTW, I am using MS Word 2003 and MathCAD 15

Highlighted

Re: Automating copy and paste through VB

I would say this can't be done. I cannot see a way of selecting the regions to copy sorry.

Mike

Highlighted

Re: Automating copy and paste through VB

While looking through the "Extra Components.xmcd" file here:

http://communities.ptc.com/thread/36057

I noticed one of the gentlemen spoke about internal page counters. I would like to know if there is a way, either by using regular MathCAD class commands, or through some backdoor API to manipulate the page counters to change pages in a Do Loop kind-of-deal.

I have found the bit of code necessary for activating the document, how to determine what kind of region is on the Worksheet, and how to find the region's horizontal and vertical positions. I may be able to figure out how to select all of the regions on a particular page that is displayed, but Im unsure of how to cycle through the pages and copy all of the regions on a page to the clipboard.

Highlighted

Re: Automating copy and paste through VB

Could you not use a scripted component to open the Mathcad sheet and save as a *.rtf file?

Mike

Highlighted

Re: Automating copy and paste through VB

I looked into that, but I need the Word document to have live links into the MathCAD document. That, and its a formatting nightmare!

What about any feature like this on MathCAD Prime, or Prime 2.0? I sure hope they are listening to the end-user's needs!

Highlighted

Re: Automating copy and paste through VB

In Mathcad Prime there is no support for Word documents. You can make export of working documents only in formats - XPS and PDF.

Highlighted

Re: Automating copy and paste through VB

If that wont work I can't see any way around your problem.

As Vladimir states, Prime doesn't have the ability either.

Mike

Highlighted

Re: Automating copy and paste through VB

Mike,

What about using the Window Class method Activate, in conjunction with the Region class's MCRegionType?

OR, could it be possible to go through and create an ordered name generator to name all of the Region's Tag values, then cycle through them using the Window Classes' ScrollToRegion Method?

Just a thought!

Highlighted

Re: Automating copy and paste through VB

OR, could it be possible to go through and create an ordered name generator to name all of the Region's Tag values, then cycle through them using the Window Classes' ScrollToRegion Method?

Once you have scrolled to a region, how do you intentd to copy it to the clipboard?

Highlighted

Re: Automating copy and paste through VB

...Could I simply Activate the region and use sendkeys to copy it to the clipboard? I know thats not very reliable, but perhaps it would work...

Highlighted

Re: Automating copy and paste through VB

...nevermind. It doesn't look like I even CAN do SendKeys through the MathCAD application...

Highlighted

Re: Automating copy and paste through VB

I am pretty much locked in with my choices concerning what programs I can use, so I would really appreciate any feedback on this and whether or not its even possible.

If it is, then I certainly have no idea how to do it. You would have to make Mathcad copy stuff to the clipboard, but that is not available via Mathcad's automation interface. I see no way around that limitation. Sorry.

Announcements