Hello all,
I have a vba code that must pick up an adobe illustrator file and generate ldf and tiff format, but that code is only working for ldf generation but not tiff.
Below is the code that is giving the error. for tif conversion.
Public Sub makeTiffFile()
’ Dim appPS As Photoshop.Application
’ Dim docPS As Photoshop.Document
Dim appPS As Object
Dim docPS As Object
Dim pdfOpenOption As Object
Dim trgFLS As Files
Dim tmpFL As File
Dim fExtension As String
Dim fName As String
Dim Ret As Boolean
Dim cnt As Integer
Dim chkFolder As MSForms.CheckBox
'On Error GoTo Err
Set appPS = CreateObject(“Illustrator.Application”)
'commented for testing for myself
'appPS.DisplayDialogs = psDisplayNoDialogs
appPS.Visible = False
'Set pdfOpenOption = CreateObject(“Illustrator.pdfOpenOptions”)
'pdfOpenOption.AntiAlias = True
'pdfOpenOption.CropPage = psArtBox
'pdfOpenOption.Mode = psGrayscale
'pdfOpenOption.Page = 1
'pdfOpenOption.Resolution = 300
'pdfOpenOption.SuppressWarnings = True
cnt = 0
If chkFolder.Tiff Then
Set trgFLS = WorkFolder.Files
Else
Set trgFLS = InFolder.Files
End If
For Each tmpFL In trgFLS
fName = FSO.GetBaseName(tmpFL.Path)
fExtension = FSO.GetExtensionName(tmpFL.Path)
If LCase(fExtension) = “ai” And chkFolder.Tiff Then
If chkFile(cnt).fileName & chkFile(cnt).fileType = fName And _
chkFile(cnt).TargetFlg Then
Set docPS = appPS.Open(tmpFL.Path, pdfOpenOption)
Else
'GoTo Retry_Err
End If
'ElseIf (LCase(fExtension) = “tif” Or LCase(fExtension) = “tiff”) Then
’ Set docPS = appPS.Open(tmpFL.Path)
'Else
'GoTo Retry_Err
'End If
If ResizeImageFile(appPS, docPS) Then
Call LogOutputMark(chkLog.LogSave, chkFile(cnt).fileName & “.” & fExtension, 2)
Else
Call LogOutputError(chkLog.LogSave, chkFile(cnt).fileName & “.” & fExtension, 2)
'GoTo Err
End If
End If
’ Call docPS.ChangeMode(PsChangeMode.psConvertToGrayscale)
Call docPS.ChangeMode(psConvertToGrayscale)
Call TwoTone(appPS)
Call SaveTiffFile(docPS, TiffFolder)
Call LogOutputMark(chkLog.LogSave, chkFile(cnt).fileName & “.” & fExtension, 1)
Call docPS.Close(psDoNotSaveChanges)
Set docPS = Nothing
'Next
'Retry_Err:
'cnt = cnt + 1
'Next
'appPS.DisplayDialogs = psDisplayAllDialogs
'PhotoshopI—¹
'appPS.Quit
’ Set appPS = Nothing
’ Set pdfOpenOption = Nothing
’ Exit Sub
'Err:
'If Not docPS Is Nothing Then
’ Call docPS.Close(psDoNotSaveChanges)
’ Set docPS = Nothing
'End If
'If Not tmpFL Is Nothing Then
’ Call LogOutputError(chkLog.LogSave, chkFile(cnt).fileName & “.” & fExtension, 1)
’ Set tmpFL = Nothing
'End If
'Resume Retry_Err
End Sub