Size Format of Images in Worksheets

  • Thread starter Thread starter gki
  • Start date Start date
G

gki

Hello All,

I hope that I would get an answer to this request.

I have a userform with a command button to see the print preview; Onc
I click it, I can get all my information to the worksheet together wit
the picture.

However I cannot resize the picture on worksheet since picture size
changes from one id number to another..... Sometimes I get smal
pictures and sometimes bigger. Then it is so difficult for me to figur
out an standard size per picture.


Is there any solution that can help me out???

Private Sub cmdprintd_Click()
Static comp As Object
Dim rngCell As Range
Application.ScreenUpdating = False
Dim px As Picture
For Each px In Sheets("Sheet1").Pictures
px.Delete
Next px
Sheets("Sheet1").Activate
Range("BG405:BJ417").Select
Set rngCell = ActiveCell
Set comp = ActiveSheet.Pictures.Insert("PathName"))

comp.Top = rngCell.Top
comp.Left = rngCell.Left



Application.ScreenUpdating = True
On Error GoTo 0

Sheets("Sheet1").Range("BD401").Value = txtcode.Value


Me.Hide
Sheets("Sheet1").PrintPreview
Me.Show

End Sub


Thank you

:confused
 
I suspect you've been led astray by the macro recorder, which
records .ScaleHeight & .ScaleWidth when re-sizing an object.
It's much simpler to use .Height & .Width properties instead.
comp.Top = rngCell.Top
comp.Left = rngCell.Left
comp.Height = 55
comp.Width = 66


Regards,
Vic Eldridge
 
Thank you very much Vic,

It is just perfect...... so I dont need to adjust all the images pe
code at all...

:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top