ratliffjm
asked on
VBSCRIPT that opens a RTF file in word PRINT PREVIEW mode and saves it in another folder
Hello EE,
I have several rtf files that were created using SAS. The page numbers (Page x of y) "appear" to be missing but can be seen if opened in "Print Preview" or when the table is printed. What I would like to do is run a vbscript that does the following: 1) opens the file in "Print Preview (CTRL+F2)" mode. 2) file "save as" the same file in another folder. This saved file will now show the page numbers. I currently have about 100 files and I really don't want to do this to each one. I am attaching the file as an example. This script will then be used as the second step of the process to see the page number values.
Thanks in advance for your help...
Jeff
LBI-PTRB3SCR-smdisd1-test.doc
I have several rtf files that were created using SAS. The page numbers (Page x of y) "appear" to be missing but can be seen if opened in "Print Preview" or when the table is printed. What I would like to do is run a vbscript that does the following: 1) opens the file in "Print Preview (CTRL+F2)" mode. 2) file "save as" the same file in another folder. This saved file will now show the page numbers. I currently have about 100 files and I really don't want to do this to each one. I am attaching the file as an example. This script will then be used as the second step of the process to see the page number values.
Thanks in advance for your help...
Jeff
LBI-PTRB3SCR-smdisd1-test.doc
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Script" S:\REFMAL197\pageit.vbs
Line:16
Char: 1
Error: Path not found
Code: 800A004C
Source: Microsoft VBScript runtime error
My edited code is below. I think I made a mistake with the C_FOLDER_BASE. What should be the path of this value?
Option Explicit
Const C_FOLDER_BASE = "S:\REFMAL197\Deliverable\
Const C_FOLDER_INP = "S:\REFMAL197\Deliverable\
Const C_FOLDER_OUT = "S:\REFMAL197\Deliverable\
Const wdFormatDocument = 0
Dim oWrdApp, oWrdFil, oFS, oFolderInp, oFile, oFolderOut
Set oWrdApp = CreateObject("Word.Applica
oWrdApp.Visible = True
Set oFS = CreateObject("Scripting.Fi
Set oFolderInp = oFS.GetFolder(C_FOLDER_BAS
For Each oFile In oFolderInp.Files
If LCase(Right(oFile.Name, 4)) = ".rtf" Then
Set oWrdFil = oWrdApp.Documents.Open(oFi
oWrdFil.PrintPreview
oWrdFil.SaveAs C_FOLDER_BASE & C_FOLDER_OUT & Left(oFile.Name, Len(oFile.Name) - 3) & "doc", wdFormatDocument, , , False
oWrdFil.Close False
Set oWrdFil = Nothing
End If
Next
Set oFolderInp = Nothing
Set oFS = Nothing
oWrdApp.Quit
Set oWrdApp = Nothing
Thanks so much!!!
Jeff