Sign in to follow this  
Followers 0
SummerGirl

Some clarifications & help needed

6 posts in this topic

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.

Share this post


Link to post
Share on other sites



  1. 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"
  2. You need to provide more information (the code you use)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

  1. Correct. Did you test? What was the result?
  2. 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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes. 1. & 2. works with your help :thumbsup: 

Thank you!!

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0