ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Size Format of Images in Worksheets (https://www.excelbanter.com/excel-programming/304778-size-format-images-worksheets.html)

gki[_4_]

Size Format of Images in Worksheets
 
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

--
Message posted from http://www.ExcelForum.com


Vic Eldridge

Size Format of Images in Worksheets
 
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





gki wrote in message ...
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; Once
I click it, I can get all my information to the worksheet together with
the picture.

However I cannot resize the picture on worksheet since picture sizes
changes from one id number to another..... Sometimes I get small
pictures and sometimes bigger. Then it is so difficult for me to figure
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:


---
Message posted from http://www.ExcelForum.com/


gki[_5_]

Size Format of Images in Worksheets
 
Thank you very much Vic,

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

:

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com