![]() |
#4
|
|||
|
|||
![]()
Thanks for the reply.
I'm pretty sure its a template that i am working on as its a .dotm extension. The reason for the two command codes is because i tried the one it worked great but doesnt when its opened of the website as READ ONLY so i cut that code and pasted it somewhere else and used a new code to try and figure out how to get the document out of the read only but havent had much luck with the smaller second code. Quote:
Quote:
Quote:
I know the basics of word but once i get further into detail with macro's and Visual Basic i'm basically teaching myself as i'm building this document. Thanks, Randy Here is some code i got to come close to what i'm attempting. The formatting is still alittle messed up as in the margins and spacing but it shows the tables in there. I put a note in there which is just a place holder to when i figured out how to acheived what i'm looking for then i was going to add the first code (the longer one) and piece that into there and it should in theory work the way i'd like it to. Code:
Private Sub CommandButton1_Click() Dim oSection As Section Dim r As Range Dim TempDoc As Document Dim FirstPara As String For Each oSection In ActiveDocument.Sections Set r = oSection.Range r.End = r.End - 1 Set TempDoc = Documents.Add With TempDoc ActiveDocument.Paragraphs(1).Range.FormattedText = r FirstPara = r.Paragraphs(1).Range.FormattedText FirstPara = Left(FirstPara, Len(FirstPara) - 1) ChangeFileOpenDirectory "E:\Documents and Settings\" & Environ("username") & "\Desktop\EMS\" .SaveAs FileName:=FirstPara & ".docx" 'Dont have this close yet make it print then email and close .Close End With Set r = Nothing Set TempDoc = Nothing Next End Sub Last edited by rmw85; 05-03-2012 at 06:54 AM. Reason: Added code |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rmw85 | Word VBA | 1 | 04-25-2012 01:02 PM |
![]() |
HorizonSC | Word | 2 | 11-15-2011 03:26 AM |
Check Boxes and Command Buttons | Micky P | Word VBA | 0 | 10-27-2011 01:06 AM |
![]() |
cksm4 | Word VBA | 7 | 02-27-2011 08:47 PM |
![]() |
aubreylc | Outlook | 2 | 04-07-2010 12:53 PM |