Thanks a lot again for your reply.
I think i didnt explain quite well what i try to do. Sorry.
When i run the macro with F5 from Excel it does nothing.... i think i mess something in there
So, i have this folder C:\MIHAI\DOC\ASIG\DOSARE
in this folder will be various jpg and pdf files that i want to convert to 1 single pdf .
2024-02-03 06_24_52-DOSARE.jpg
The output folder i want to be the same folder as the input one.
So I modified your code but I think i did something wrong
Option Explicit
Sub subTestMagick()
Const conType As String = "*.jpg"
Dim col As New Collection
Dim sFile As String, j As Integer
Dim path As String, ext As String
' change the path to the correct path of your jpg's
' right now it will check all jpgs in Document folder.
path = "C:\MIHAI\DOC\ASIG\DOSARE"
sFile = Dir$(path & conType)
Do Until Len(sFile) = 0
j = j + 1
col.Add Item:=sFile, Key:=j & ""
sFile = Dir$
Loop
For j = 1 To col.Count
Call ConvertJpgToPdfUsingMagick(col(j), Replace$(col(j), ".jpg", ".pdf"))
Next
End Sub
Sub ConvertJpgToPdfUsingMagick(ByVal inputImagePath As String, ByVal outputPdfPath As String)
'Dim inputImagePath As String
'Dim outputPdfPath As String
Dim command As String
' Set the paths
inputImagePath = "C:\MIHAI\DOC\ASIG\DOSARE\Image.jpg"
outputPdfPath = "C:\MIHAI\DOC\ASIG\DOSARE\Output.pdf"
' Build the command
command = "C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe convert """ & inputImagePath & """ """ & outputPdfPath & """"
' Execute the command
Shell command, vbHide
End Sub
Sorry I am such a newbie at this.
Your help is greatly appreciated.
Thanks.