![]() |
#1
|
|||
|
|||
![]()
Hi - I'm used to using VBA in excel but new to Word although I appreciate they should be similar.
My issue is that I have a word doc with VBA that sends the doc as an attachment through outlook. I've copied and pasted it but that bit seems to work ok. The issue is that it is not sending through any amended contents (which I believe is due to the doc not being saved before emailed) so what I was going to do was add a line in to save the doc and then attach. The doc contains two separate tables which I would like to know if I can clear the contents of 1 column in after the document is added to the email so I can save again in its original state. ie user completes tables and runs VBA document saved added to email clears contents of table document saves I can't seem to work out how I would reference the 2 tables to clear the contents. In excel I would name a range etc but can't see how to do similar in Word. My current code is HTML Code:
Private Sub CommandButton1_Click() Dim olkApp As Object Dim strSubject As String Dim strTo As String Dim strBody As String Dim strAtt As String strSubject = "Testing" strBody = "<p style='font-family:arial;font-size:12pt'>" & "Please see the attached document." & "</p>" strTo = xxxxxxxxx@xxxxxx.com strAtt = ActiveDocument.FullName Set olkApp = CreateObject("outlook.application") With olkApp.CreateItem(0) .OriginatorDeliveryReportRequested = True .To = strTo .Subject = strSubject .HTMLbody = strBody & vbCrLf & vbCrLf .attachments.Add strAtt '.send .Display End With ActiveDocument.Close _ SaveChanges:=wdSaveChanges, _ OriginalFormat:=wdOriginalDocumentFormat Set olkApp = Nothing End Sub |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
JasonMichelM | Mail Merge | 4 | 09-15-2017 06:31 PM |
Creating a Table of Contents in a table format | Ellymoo | Word | 9 | 06-22-2017 08:15 AM |
Table of contents with section breaks (text in table in header) | Dmonk | Word | 2 | 05-23-2017 04:29 AM |
![]() |
donaldadams1951 | Word VBA | 4 | 02-04-2015 03:54 PM |
![]() |
dynamictiger | Word Tables | 4 | 07-21-2014 10:16 PM |