Skip to main content
1-Visitor
October 13, 2011
Question

Automating copy and paste through VB

  • October 13, 2011
  • 3 replies
  • 5856 views

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!

3 replies

1-Visitor
October 13, 2011

BTW, I am using MS Word 2003 and MathCAD 15

1-Visitor
October 18, 2011

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

Mike

1-Visitor
October 18, 2011

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.

1-Visitor
October 18, 2011

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

Mike

19-Tanzanite
October 18, 2011

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.