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("C
Word doc path.docx")
With WordDoc
.Bookmarks("Name").Range.Text = txt_Name.Value
.Bookmarks("Date").Range.Text = txt_Date.Value
End With