Hey,
I have some code that pulls data from a SQL table into a new email. At the moment the results just appear as multiline text, but I would like them to be put into a table.
This is what I am using:
'Create table with 1 row and 3 columns as header, grey the background
Command.CommandType = adCmdStoredProc
Command.CommandText = "dbo.ef_sp_GetRemoteDocs"
Command.Parameters.Append Command.CreateParameter("@BatchId", adGUID, adParamInput, 36, BatchID)
Set Recordset = Command.Execute
Do While Not Recordset.EOF
DocumentID = Mid$(Recordset("DocumentId"), 2, 36)
FileName = Recordset("FileName")
FileSize = Recordset("FileSize")
'Add row for each record, and write data to each cell
Sel.Hyperlinks.Add Anchor:=Sel.Range, Address:=BaseURL & "/default2.aspx?DocumentID=" & DocumentID, ScreenTip:=FileName, TextToDisplay:=FileName
Sel.TypeText " (" & Format(FileSize / 1024, "#,###") & " KB)" & vbCrLf
Recordset.MoveNext
Loop
Recordset.Close
Set Recordset = Nothing
So it creates a hyperlink and puts the filesize in brackets after.
I cannot figure out how to programmatically create a table in Outlook!
Thanks.