View Single Post
 
Old 09-16-2013, 12:51 PM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 678
BobBridges will become famous soon enoughBobBridges will become famous soon enough
Default

I dunno about preserving the column widths, molesy. Tony says you can adjust them manually after it's been embedded, and if that's the case you oughta be able to do it with VBA too. But whether there's any way to embed the workbook in Word without the column widths changing, I couldn't say; I've never experimented with this. Maybe if you set the column widths to some value in Excel and then embed the document, it'll work.

As for your question about the button, sure, you can create a button in Excel that'll embed the workbook in Word. But it's a process that happens in the Word object, so your VBA code in Excel will have to open up the Word object and refer to methods and properties in that object to get it done.

That means you have to learn how to do the same task in VBA/Word. The Word object model is different from Excel's (naturally), so it may take some getting used to. I know a little about the Word object, but not very much. If I had to do this, I'd create a VBA program in Word, learn to embed an Excel workbook there, then just figure out how to do the same thing in an Excel macro by invoking the Word application object and going on from there.

And of course once you've figured out how to do that, maybe you can have the same program finish up by setting the column width explicitly after the embedding is done, if that's still necessary.
Reply With Quote