S
Sb
Hello,
I almoast complete my application that includes inserting photos in the
document. Som photos happens to be large that makes Excel file too fat and
Excel eventualy copaps.
Below is rutine I use to insert photo. I wonder if there may be any
modifications that insereted photo will be reduced to 200 dpi when inserted.
This is possible when photo is inserted manualy. I do not know how to make
this automatically... I mean in the code.
Another solution may be to check size of phto that is about to be inserted
and to denay users to insrert larger photos than 150 Kb??
Any help is much appreciate,
Regards Boro
Following is my rutine:
Sub InsPhoto1B()
'
' There must bi one photo name P1Bn in the active page for this code to
work. Code find photo named P1Bn learn position and size, then place photo
that you browsed, exactly on top of P1Bn
Dim PhSize As Integer
ChkSize
If Application.ScreenUpdating = True Then Application.ScreenUpdating = False
With ActiveSheet.DrawingObjects("P1Bn")
P1L = .Left
P1T = .Top
P1W = .Width
P1H = .Height
End With
ActiveSheet.Unprotect Password:=PasswordP
If Sheets("Data").Range("B23").Value = 1 Then
ActiveSheet.DrawingObjects("P1Br").Delete
Sheets("Data").Range("B23").Value = 0
End If
If Application.Dialogs(xlDialogInsertPicture).show Then
With Selection
.Left = P1L
.Top = P1T
.Height = P1H
.Width = P1W
.Name = "P1Br"
End With
Sheets("Data").Range("B23").Value = 1
End If
ActiveSheet.Protect PasswordP, True, True, True, True
Application.ScreenUpdating = True
End Sub
I almoast complete my application that includes inserting photos in the
document. Som photos happens to be large that makes Excel file too fat and
Excel eventualy copaps.
Below is rutine I use to insert photo. I wonder if there may be any
modifications that insereted photo will be reduced to 200 dpi when inserted.
This is possible when photo is inserted manualy. I do not know how to make
this automatically... I mean in the code.
Another solution may be to check size of phto that is about to be inserted
and to denay users to insrert larger photos than 150 Kb??
Any help is much appreciate,
Regards Boro
Following is my rutine:
Sub InsPhoto1B()
'
' There must bi one photo name P1Bn in the active page for this code to
work. Code find photo named P1Bn learn position and size, then place photo
that you browsed, exactly on top of P1Bn
Dim PhSize As Integer
ChkSize
If Application.ScreenUpdating = True Then Application.ScreenUpdating = False
With ActiveSheet.DrawingObjects("P1Bn")
P1L = .Left
P1T = .Top
P1W = .Width
P1H = .Height
End With
ActiveSheet.Unprotect Password:=PasswordP
If Sheets("Data").Range("B23").Value = 1 Then
ActiveSheet.DrawingObjects("P1Br").Delete
Sheets("Data").Range("B23").Value = 0
End If
If Application.Dialogs(xlDialogInsertPicture).show Then
With Selection
.Left = P1L
.Top = P1T
.Height = P1H
.Width = P1W
.Name = "P1Br"
End With
Sheets("Data").Range("B23").Value = 1
End If
ActiveSheet.Protect PasswordP, True, True, True, True
Application.ScreenUpdating = True
End Sub