SummerGirl Posted October 12, 2013 Share Posted October 12, 2013 Dear all, I have 2 clalrifications: 1. I am now using _Excel_PictureAdd function to add pictures but the expected ratio is not achieved.I want my png file to fit from B18 to H30 but now its not as I expect and becomes smaller. is there anything I need to do? The script is as follow: $Count2=18 $bitmap= FileReadLine ("C:Testimage"& "filename.txt", $j) _Excel_PictureAdd($oWorkbook, $oWorkbook.Activesheet, "C:Testimage"&""& $bitmap, "B"&$Count2&":"&"H"&$Count2+11) 2. I want to copy many bitmaps...but when any bitmap is not available I want to write a comment "NG" in red font and go to next. Now with the present code it stops in between. Can anyone help me. Link to comment Share on other sites More sharing options...
water Posted October 12, 2013 Share Posted October 12, 2013 If you want to fit the picture exactly in the specified range you need to set parameter $bScale = False. "False will fill the $vRangeOrLeft regardless of original aspect ratio" You need to provide more information (the code you use) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SummerGirl Posted October 12, 2013 Author Share Posted October 12, 2013 1. Do you mean it should be like this. _Excel_PictureAdd($oWorkbook, $oWorkbook.Activesheet, "C:Testimage"&""& $bitmap, "B"&$Count2&":"&"H"&$Count2+11,Default, Default, Default, False) 2. This worked...but could not change the font color. if FileExists("C:testimage"&""& $bitmap) Then _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $bitmap,"J"&$Count1) Else _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet,"NG","B"&$Count2) EndIf Now I can write NG.....but want to change font color...and if possible make it bold. Thanks in advance Link to comment Share on other sites More sharing options...
water Posted October 12, 2013 Share Posted October 12, 2013 Correct. Did you test? What was the result? Setting font properties is out of the scope of this UDF. I haven't yet found a sensible way to include this So you have to do it yourself: $oWorkbook.Activesheet.Range("B" & $Count2).Font.Bold = True ; $iColor is either a Colorindex (1-255) or a hex value (RGB colors) If $iColorIndex < 255 Then $oWorkbook.Activesheet.Range("B" & $Count2).Font.ColorIndex = $iColor Else $oWorkbook.Activesheet.Range("B" & $Count2).Font.Color = $iColor EndIf My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SummerGirl Posted October 12, 2013 Author Share Posted October 12, 2013 Yes. 1. & 2. works with your help Thank you!! Link to comment Share on other sites More sharing options...
water Posted October 12, 2013 Share Posted October 12, 2013 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now