Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2013, 12:51 PM
BobBridges's Avatar
BobBridges BobBridges is offline VBA code to fix column widths Windows 7 64bit VBA code to fix column widths Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to transpose the datas of part code and supplier into row and column PRADEEPB270 Excel 3 10-26-2012 07:22 PM
VBA code for count w and write into another column in excel tomlam Excel Programming 2 10-09-2012 03:56 AM
VBA code to fix column widths Alternate Table Column Widths on even and odd pages robrastelli Word 4 08-08-2012 07:33 PM
VBA code to fix column widths Altering Column Widths on Two Col Page abrogard Word 2 12-30-2010 06:03 AM
Seperate Column widths in one worksheet miller.3276 Excel 2 01-27-2010 02:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft