Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change picture brightness from copy/pasted image

Status
Not open for further replies.

flashbbeb

MIS
Mar 29, 2005
106
US
Hi all,

The premise here is that the user clicks a button in the ribbon, and the image is copied from the hidden location and pasted where desired in a table. But I want to make sure the image cannot be seen from where it is being copied.

What I came up with was - hiding the images by changing the brightness and contrast to 100% (is there a better way?) and bookmarking them so the macro knows the location when it copies and pastes it later.

The problem is that when it's pasted, the code I have to reset the brightness and contrast just gives me a gray box. I'm by no means a programmer, but I do have an idea of what to do to tweak code after recording a macro.

Code:
Public Sub promptVideo(control As IRibbonControl) 
    Selection.GoTo What:=wdGoToBookmark, Name:="video"
    Selection.Copy
    Application.GoBack
    Selection.SelectRow
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.SelectCell
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.InlineShapes(1).PictureFormat.Brightness = 0.2
    Selection.InlineShapes(1).PictureFormat.Contrast = 0.5

End Sub

Any thoughts on how to make the pasted image display properly?

Thanks, EB
 


hi,

Why not just hide the sheet where you store the images?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Oops - sorry - forgot to mention I'm doing this in Word.
 


You don't need to change the contrast, just the brightness from 1 to .5
Code:
ShapeObject.PictureFormat.Brightness = 0.5
Do you have shapes or inline shapes?

Here is you problem, I believe. Collections are not indexed by their position. Rather, by the order of insertion. So the inline shape you just added to the collection py pasting into the document is the LAST ONE in the collection, So...
Code:
With ThisDocument
   with .InlineShapes(.InlineShapes.Count).PictureFormat
      .Brightness = 0.5
      .Contrast = .5
   end with
end with

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


oops, it seems that the InLine shapes collection are indexed by order of appearance in the document.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 

Code:
    With Selection.InlineShapes(1).PictureFormat
         .Brightness = 0.5
         .Contrast = 0.5
    End With

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top