Hi guys,
I have written outlook vba code to save all the emails down in pdf format in a folder with specific naming conventions . The PDF file names need to start with Account number but when the files get saved down then there are 2 blank characters appearing in the beginning of file name .
I have used trim function already so not sure how to get rid of those characters . Any help will be much appreciated.
I have written outlook vba code to save all the emails down in pdf format in a folder with specific naming conventions . The PDF file names need to start with Account number but when the files get saved down then there are 2 blank characters appearing in the beginning of file name .
I have used trim function already so not sure how to get rid of those characters . Any help will be much appreciated.
Code:
strAccNo = Trim(strNo(2))
sFileName = Trim(strAccNo) & "-" & "Holiday Request" & "-" & "Holiday TE" & "-" & "CUST" & "-" & strUserID & "--" & Format(Now, "yyyymmddhhmm")
sFilePath = m & sFileName & ".txt"
' Create .pdf file of the selected email item
Dim objDoc As Object, objInspector As Object
Set objInspector = myItem.GetInspector
Set objDoc = objInspector.WordEditor
objDoc.ExportAsFixedFormat PDFFile & sFileName & ".pdf", 17
Set objInspector = Nothing
Set objDoc = Nothing
Last edited: