BookmarkSubscribeRSS Feed
Calcite | Level 5

bRecursive = False
sFolder = "D:\Users\gci0mxm\Desktop\Test"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oWord = CreateObject("Word.Application")
oWord.Visible = True

Set oFolder = oFSO.GetFolder(sFolder)

Sub ConvertFolder(oFldr)
For Each oFile In oFldr.Files
If LCase(oFSO.GetExtensionName(oFile.Name)) = "rtf" Then
Set oDoc = oWord.Documents.Open(oFile.path)
Str = left(oFile,instr(1,oFile,".")-1)
oWord.ActiveDocument.SaveAs Str & ".pdf", 17
End If

If bRecursive Then
For Each oSubfolder In oFldr.Subfolders
ConvertFolder oSubfolder
End If
End Sub


I have created vbs file in linux server but I can't able to run inside the linux server. 

Can you help me to run vbs file in linux server or any other alternate solutions for generating pdf from rtf in SAS (HMS/cloud).


Super User

You need a VB runtime executable on Linux. Your admins for the SAS server can help you in this regard. And you must be able to run external commands (SAS system option XCMD set), for which you also need your SAS admins.

Super User

But this


makes me suspect that you actually use Word for the conversion. Word is only available on Windows.

LibreOffice is available on Linux and can do such conversions from the commandline, IIRC.

Super User
If you don't have permissions you may be able to add ODS PDF statements depending on the code used to have a PDF generated instead of RTF.

VBS typically doesn't run on Linux, usually a different approach is used.
Meteorite | Level 14
vbs does not run in the Linux environment.
If your objective is to convert rtf to pdf in a Linux environment there are command line utilities available to do the job. Speak to the Linux team for assistance.

SAS Employee

This is not anything related to SAS Administration nor Deployments. The only thing roughly making this something interesting to SAS users in this community is your question is about doing something with data on a SAS hosted platform.


There is nothing built into any SAS product to do this. If the source of the RTF is SAS ODS, simply update the program to use a PDF destination in addition to RTF. If the rtf file is produced outside of SAS then your only chance would be to find a package supported by Red Hat that can accomplish this.


My quick search reveals there is a possibility for LibreOffice to have an ability to take an RTF files and convert it to a PDF. See the --convert-to argument in the LibreOffice documentation here.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1 like
  • 5 in conversation