|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 06/30/2009 at 02:55PM PDT, ID: 24534904 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: |
Const template_dir As String = "C:\Documents and Settings\cvandenberg\My Documents\ALI\Word\"
Sub WriteReport()
Const ERR_APP_NOT_RUNNING As Long = 429
'*********** Use for development of code **************
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim wdDoc As Word.Document
Dim wrdPDoc As Word.Document
Dim wrdLDoc As Word.Document
'*********** Use for deployment of code **************
'Dim wrdApp As Object
'Dim wrdDoc As Object
'Dim wdDoc As Object
'*****************************************************
On Error Resume Next
Set wrdApp = GetObject(, "Word.Application")
If Err = ERR_APP_NOT_RUNNING Then Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents("Template_Title_Page.doc")
'If wrdDoc Is Nothing Then Set wrdDoc = wrdApp.Documents.Open("C:\Documents and Settings\cvandenberg\My Documents\ALI\Word\Template_Title_Page.doc")
If Err = 4160 Then Set wrdDoc = wrdApp.Documents.Open("C:\Documents and Settings\cvandenberg\My Documents\ALI\Word\Template_Title_Page.doc")
wrdApp.Visible = True
Err.Clear
With wrdDoc
If PublicFunctions.FileExists("C:\Documents and Settings\cvandenberg\My Documents\MyNewWordDoc.doc") Then
Set wdDoc = wrdApp.Documents("MyNewWordDoc.doc")
'If Not wdDoc Is Nothing Then wdDoc.Close
If Err <> 4160 Then wdDoc.Close
Set wdDoc = Nothing
End If
Call insertPage(wrdApp, wrdDoc, "Landscape")
Call insertPage(wrdApp, wrdDoc, "Portrait")
.saveAs ("C:\Documents and Settings\cvandenberg\My Documents\MyNewWordDoc.doc")
.Close ' close the document
End With
Set wrdDoc = Nothing
'Only closes Word if the instance was created by this code
If Not wrdApp.UserControl Then
wrdApp.Quit ' close the Word application
Set wrdApp = Nothing
End If
On Error GoTo 0
End Sub
Sub insertPage(wrdApp As Object, wrdToDoc As Object, orient As String)
Dim wrdFromDoc As Object
Dim pOrient As Integer
Dim itemIndex As Integer
If orient = "Landscape" Then
pOrient = 1
itemIndex = 1
Else
pOrient = 0
itemIndex = 1
End If
On Error Resume Next
Set wrdFromDoc = wrdApp.Documents("Template_" & orient & "_Page.doc")
'If wrdFromDoc Is Nothing Then Set wrdFromDoc = wrdApp.Documents.Open("C:\Documents and Settings\cvandenberg\My Documents\ALI\Word\Template_" & orient & "_Page.doc")
If Err = 4160 Then Set wrdFromDoc = wrdApp.Documents.Open(template_dir & "Template_" & orient & "_Page.doc")
Err.Clear
With wrdToDoc
'Page Break
With .Paragraphs(.Paragraphs.Count).Range
.Collapse Direction:=0
.InsertParagraphAfter
.InsertBreak Type:=2
End With
With .Sections(.Sections.Count)
With .PageSetup
.Orientation = pOrient
.BottomMargin = wrdFromDoc.Sections(1).PageSetup.BottomMargin
.TopMargin = wrdFromDoc.Sections(1).PageSetup.TopMargin
.LeftMargin = wrdFromDoc.Sections(1).PageSetup.LeftMargin
.RightMargin = wrdFromDoc.Sections(1).PageSetup.RightMargin
End With
.Headers(2).LinkToPrevious = False
.Footers(2).LinkToPrevious = False
wrdFromDoc.Sections(1).Headers(itemIndex).Range.Copy
.Headers(2).Range.Paste
wrdFromDoc.Sections(1).Footers(itemIndex).Range.Copy
.Footers(2).Range.Paste
End With
End With
On Error GoTo 0
End Sub
|
Advertisement