Dear Experts,
I have a macro which create PDF from existing workbook and attaching in outlook. There are a error coming if any another excel file is open and below code gets yellow highlighted: -
strFName = ThisWorkbook.Path & ActiveWorkbook.Name
strFName = ActiveSheet.Range("k9").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
strPath & strFName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
is there any way that if i run a macro, it will find another open workbook, close them and then create pdf...?
Please advise me with your valuable codes.
Thanks in advance.
Bookmarks