Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-15-2014, 06:04 AM
jon12355 jon12355 is offline Excel to Word and delete certain tables Windows 7 64bit Excel to Word and delete certain tables Office 2007
Novice
Excel to Word and delete certain tables
 
Join Date: Oct 2014
Posts: 5
jon12355 is on a distinguished road
Default Excel to Word and delete certain tables

Hi

Looking for some help with my project, an excel multipage userform. I must state that I am very new to VBA and all the code I have got so far has been from Google searching.

The userform has a main page were users input basic details (name,date etc). There are then 10 identical multipage tabs which the user enters their objectives. Some users may have 1 objective, some may have 5,6 or 10 objectives. There is also a conclusion tab at the end. Once the form has been completed I have a command button which imports certain data into the excel spreadsheet and certain data goes into a word document using bookmarks for saving / printing. To my surprise I have got this all to work very well so far!

However, as stated above, if a user only has one objective then the word template looks ridiculous as the template needed to be created to hold up to 10 objectives.

What I would like to do if possible, is when the command button is clicked in excel and the word document is created, for the objective tables in the word document that are empty to be deleted.

The objectives start at table (8) in the word document and the cell which could be used to reference as a blank cell is Row 4, Column 2.

Before table 8 is a number of tables which bookmark the date and time etc and table 18 in the document is the conclusion. So the code needs to delete tables 8 to 17 if Row 4, Column 2 is blank.

Any help would be greatly appreciated.

I haven't put all the bookmarks as there are a lot but the word code I am currently using in excel is:

Dim AppWord As Word.Application
Dim WordDoc As Word.Document
Dim ExcSheet As Excel.Worksheet
Dim i As Integer

Set AppWord = CreateObject("Word.Application")


AppWord.Visible = True
Set WordDoc = AppWord.Documents.Add("CWord doc path.docx")

With WordDoc
.Bookmarks("Name").Range.Text = txt_Name.Value
.Bookmarks("Date").Range.Text = txt_Date.Value

End With
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel to Word and delete certain tables Blury Excel Tables in Word zachg18 Word 1 07-15-2013 11:10 PM
how to copy all ms word tables into excel rehan129 Word 0 01-28-2012 10:17 AM
Excel to Word and delete certain tables Excel Tables to MS Word ripcurlksm Word Tables 2 09-09-2011 04:59 AM
Excel to Word and delete certain tables using checkboxes to delete tables atfresh Word Tables 1 06-19-2011 09:13 PM
Excel to Word and delete certain tables working with excel tables in MS word radman154 Word Tables 1 03-25-2011 12:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:21 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