Notifications
Announcements
Dim objExcel, objWorkbook, objWorksheet, objImage Dim cellRange, imagePath,excelfilepath,sheetname ' Define your variables sheetname="%sheetname%" cellRange = "%CellRange%" ' Change to your desired range imagePath ="%ImageFile%" ' Change to your image file path excelfilepath= "%FilePath%" Set objExcel = CreateObject("Excel.Application") objExcel.Visible = False ' Make Excel visible Set objWorkbook = objExcel.Workbooks.Open(excelfilepath) ' Change the file path Set objWorksheet = objWorkbook.Sheets(sheetname) ' Select the first sheet ' Add the image to the worksheet Set objImage = objWorksheet.Pictures.Insert(imagePath) ' Set the image position based on the specified range objImage.Left = objWorksheet.Range(cellRange).Left objImage.Top = objWorksheet.Range(cellRange).Top ' Resize the image to fit within the specified range objImage.Width = objWorksheet.Range(cellRange).Width objImage.Height = objWorksheet.Range(cellRange).Height ' Save and close workbook objWorkbook.Save objWorkbook.Close objExcel.Quit ' Clean up Set objImage = Nothing Set objWorksheet = Nothing Set objWorkbook = Nothing Set objExcel = Nothing
Thanks & Regards, Nived N
Stay connected: LinkedIn | YouTube | Blogs
Was this answer helpful? If yes, please mark it as the solution by selecting the checkbox in the discussion thread. Your feedback motivates me to keep contributing. Thank you!
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 501 Super User 2025 Season 2
Tomac 323 Moderator
abm abm 237 Most Valuable Professional