-
Jun 11th, 2008, 06:10 AM
#1
Thread Starter
New Member
[resolved] question with tables in vbscript, for AD signature
I'm trying to create tables in word:
picture1,text1,picture2
but when i use this code:
Code:
On Error Resume next
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objRange = objDoc.Range()
objDoc.Tables.Add objRange,1,3,3
Set objTable = objDoc.Tables(1)
strlogo = "c:\1.PNG"
strlogo2 = "c:\2.PNG"
objTable.Cell(1, 1).Range.Text = objSelection.InlineShapes.AddPicture(strLogo)
objTable.Cell(1, 2).Range.text = "text"
objTable.Cell(1, 3).Range.text = objSelection.InlineShapes.AddPicture(strLogo2)
the 2 pictures are in the first column and the text is in the second column..
What am i doing wrong?
thanks in advance
Last edited by eatsoup; Jun 12th, 2008 at 01:05 PM.
-
Jun 11th, 2008, 09:53 AM
#2
Thread Starter
New Member
Re: question with tables in word
ok, i got it working :-)
now i have encountered another problem, the code is for adding a signature in outlook. there are 3 columns: foto1, text1, foto2
underneath that there must be added some text, how can i tell vbscript to put it under the table, here's my code
Code:
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strFirstName = objuser.givenName
StrLastName = objuser.sn
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strAddress = objuser.streetAddress
strCity = objuser.l
strState = objuser.st
strZip = objuser.postalCode
strPhone = objUser.telephoneNumber
strMobilePhone = objUser.mobile
strMail = objuser.mail
strLocation = objuser.physicalDeliveryOfficeName
strWeb = objuser.wWWHomePage
strLogo = "c:\1.jpg"
strLogo2 = "c:\2.jpg"
strDisc = "here is the disclaimer"
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objRange = objDoc.Range()
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Size = "10"
objSelection.Font.Name = "arial"
objSelection.Font.Color = RGB(51,102,255)
objSelection.Font.Bold = true
objDoc.Tables.Add objRange, 1, 3
Set objTable = objDoc.Tables(1)
objTable.Cell(1, 1).Range.Text = objSelection.InlineShapes.AddPicture(strLogo)
objTable.Cell(1, 2).select
objSelection.TypeParagraph()
objSelection.TypeText strName
objSelection.Font.Bold = false
objSelection.TypeParagraph()
objSelection.TypeText strMail
objTable.Cell(1, 3).Range.Select
objSelection.TypeParagraph()
Set objShape = objSelection.InlineShapes.AddPicture(strlogo2)
'here there must be a command to end the table
objSelection.Font.Bold = false
objSelection.Font.Size = "8"
objSelection.TypeParagraph()
objSelection.TypeText strDisc
objSignatureEntries.Add "Signature", objRange
objSignatureObject.NewMessageSignature = "Signature"
objSignatureObject.ReplyMessageSignature = "Signature"
objDoc.Saved = True
objWord.Quit
i'm sorry for my poor english
-
Jun 12th, 2008, 03:46 AM
#3
Thread Starter
New Member
Re: question with tables in vbscript, for AD signature
So I finaly found the "solution", rather a work-around
Code:
objSelection.EndKey 6
that did the trick.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|