Reputation: 1269
I am working on creating a signature in outlook using VBS to push to our users. The signature has tables in it so i can have a logo / user information side by side vs. the standard text on top of a logo. (Original table code found here: http://www.vbforums.com/showthread.php?526706-resolved-question-with-tables-in-vbscript-for-AD-signature)
Below is a snipit of the code that writes to the doc file. The code sucessfully creates two coluns and puts whatever information i want into them. The problem is, if i enter a horizontal line at the top of table1 and table2, there is a gap between the two tables. My question is, can you control the gap between two tables of a document using vbs?
objDoc.Tables.Add objRange, 1, 2
Set objTable = objDoc.Tables(1)
'** Logo column **
'Draw a horizontal line (This only draws it for this frame)
objSelection.InlineShapes.AddHorizontalLineStandard
objTable.Cell(1, 1).select
'Put Logo information here
'** User column **
'Draw a horizontal line (This only draws it for this frame)
objSelection.InlineShapes.AddHorizontalLineStandard
objTable.Cell(1, 2).select
'Put User information here
objSelection.EndKey 6 'Command to end the above tables
Upvotes: 0
Views: 4073
Reputation: 1269
I never could get the lines to touch when manually creating a word document. But, I have actually answered my own question by avoiding the above entirely. I added a line above the table.
Link: Add Text Above MSWord Table Using VBS
Upvotes: 0
Reputation: 42182
This code is in effect VBA and the trick there is to record a macro in word that does just that one thing you struggle with, eliminate the gap. So, manually create your table, find out the best way to remove the gap and then record this action. Then look in the resulting macro for the used vba code and insert that in your script. If it works, please publish your solution here. Success.
Upvotes: 0