Hi friends,
I want to convert word files to pdf. It was working fine till today on 32 bits system but now on after shifting to 64 bits windows 7 office 7 it's not giving output. It's running without error but not converting word files from folder to pdf. The workbook is same and I have set all the references word, excel correctly.
Option Explicit
Sub ConvertToPDFB()
Const strFolder As String = "D:\CONTACT DIRECTORY\OUTPUT B\"
Dim strFile As String, strDocNm As String, wdDoc As Document, appWord As Word.Application
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
Set appWord = CreateObject("Word.Application")
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
Set wdDoc = appWord.Documents.Open(Filename:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
wdDoc.SaveAs Filename:=strFolder & Split(strFile, ".")(0), FileFormat:=wdFormatPDF, AddToRecentFiles:=False
wdDoc.Close SaveChanges:=True
strFile = Dir()
Wend
Set wdDoc = Nothing
appWord.Quit
Set appWord = Nothing
MsgBox "Congratulation! The files are converted to PDF successfully.", 64
With Application
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Any help will be highly appreciated.
Thanking you,
Bookmarks