Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2011, 06:13 AM
hklein hklein is offline adding table to a particular place Windows XP adding table to a particular place Office 2007
Novice
adding table to a particular place
 
Join Date: Jul 2011
Posts: 23
hklein is on a distinguished road
Default adding table to a particular place

Hi everyone,



I would like to get some help on adding a table to a given place into a word document from an excel macro.
I used thwe word macro-recorder to get the syntax, but it doesn't work from excel, and it doesn't answer my question, how to insert the table to the place where I want it to be.

Code:
I wanted to do it something like this:
Dim objword As Object
Dim docword As Object
Set docword = objword.documents.Add(Path & "\test.dotx.")
docword.tables.add Range:=docword.Bookmarks("mybookmark"), numrows:=2, numcolumns:=2
all help would be appreciated
Thanks
Reply With Quote
  #2  
Old 07-24-2011, 04:53 PM
macropod's Avatar
macropod macropod is offline adding table to a particular place Windows 7 64bit adding table to a particular place Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi hklein,

You'd at least need to use the bookmark's range, not just its name:
docword.tables.add Range:=docword.Bookmarks("mybookmark").Range, numrows:=2, numcolumns:=2
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-25-2011, 01:45 AM
hklein hklein is offline adding table to a particular place Windows XP adding table to a particular place Office 2007
Novice
adding table to a particular place
 
Join Date: Jul 2011
Posts: 23
hklein is on a distinguished road
Default

Many thanks, it is really the solution.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding table to a particular place adding rows to word table hklein Word VBA 4 07-18-2011 12:21 AM
I delete an image but it comes back again and again to the same place!!!!!!!! Jamal NUMAN Drawing and Graphics 2 06-28-2011 04:47 AM
Adding table lines to protected form razberri Word Tables 2 10-27-2010 05:58 PM
adding table to a particular place Adding a Total row to pivot Table hannu Excel 1 09-18-2010 01:15 AM
tif will not place in word rachelp61 Word 2 10-13-2009 07:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:26 AM.


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