Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

ReSizing A Picture In Powerpoint

what is the best way to resize a picture in powerpoint.

right now i use:


to "copy" the picture to the clipboard

then i use:
' Dim oPP As PowerPoint.ApplicationClass **in code above**

I would like to change the size of the pic either after i paste it into the file or as i paste it in..

i have a vba macro that resizes a picture using:

With ActiveWindow.Presentation.Slides(lCurrSlide).Shapes(strName)
.ScaleWidth 0.65, msoFalse, msoScaleFromTopLeft
.ScaleHeight 0.75, msoFalse, msoScaleFromTopLeft
.IncrementLeft 320
.IncrementTop 350
End With

***lcurslide = current slide number***
***strName = "MYPicture" & lCurrSlide***

basically i need to re-write the vba portion into VB .net


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
PowerPoint Picture Insert
Does anyone know how to insert a picture into PowerPoint with VB when PowerPoint is not visible? This code works fine when the P.P.P. is visible.


Private Sub cmdRun_Click()
On Error GoTo AdoError

Dim ppApp As New PowerPoint.Application
Dim ppPres As New PowerPoint.Presentation

Set ppApp = New PowerPoint.Application
ppApp.Presentations.Add WithWindow:=msoTrue
Set ppPres = ppApp.Presentations.Item(1)
ppPres.Slides.Add 1, ppLayoutBlank
PicturePath = Me.lstPath.List(0) & "" & Me.lstFiles.List(0)
ppPres.Slides(1).Shapes.AddPicture(FileName:=PicturePath, LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=100, Height:=100).Select

Powerpoint Save Picture As.......AUTOMATION
Hi all

New to this.

Recorded a macro in Powerpoint. At the end the code (using vb6) I want to save an image to file (only has one image).

Macro gave me: .ActivePresentation.SaveAs "C:Picture1.jpg", ppSaveAsJPG, 0

However, when I run the code it saves the entire slide as slide1.jpg in a new folder called Picture1 !!

Driving me up the wall.

Please help.


How To Use Code Insert Picture Into Powerpoint File
Currently I can use code insert shape into a powerpoint file. But which function is for insert picture?


PowerPoint 'Save As Picture' URGENT HELP REQUIRED
Is there no access at all to the 'Save As Picture' option for a shape (accessed by through the right-click shortcut menu) through a VBA command? I tried creating a macro, but the code created just exports the whole slide as an image into a folder.

The result I want is the image plus it's transparency.

I'm stuck, so some sort of help would be excellent.


Resizing With GDI+ Into A Picture Box
I'm using OnErr0r's GDI+ wrapper (which is tremendous by the way!) and am trying to take a picture from picture box, resize (in effect zooming in), and stick the resized image back into the picture box (which is later passed back as a stdpicture).

I thought it was relavtively straight forward... but I must not understand the what the graphics object is doing... I think my problem is probably in the CreateFromGraphics method.... here is what I've got :

' Set GDI image objects
Set lGDIP = New cGDIP
Set lbmpImage = New cBitmap
Set lbmpNew = New cBitmap
Set lgfxGraphic = New cGraphics

' Create the Bitmap from the picture box
llSuccess = lbmpImage.CreateFromHBitmap(picImage.Picture.Handle)
picImage.Picture = lbmpImage.Picture

' Set the picture handle to the graphic object
lgfxGraphic.CreateFromHdc picImage.hDC

' Draw the bigger image
lgfxGraphic.DrawImageRectI lbmpImage.Handle, 0, 0, lbmpImage.Width * 1.2, lbmpImage.Height * 1.2

' Get the larger size image from the graphic object
llSuccess = lbmpNew.CreateFromGraphics(lbmpImage.Width * 1.2, bmpImage.Height * 1.2, lgfxGraphic.Handle)

' Set the picture box picture to the new resized image
Set picImage.Picture = Nothing
picImage.Picture = lbmpNew.Picture

' Set the graphic to nothing
Set lgfxGraphic = Nothing

' Get rid of the image
Set lbmpImage = Nothing

' Get rid of the image
Set lbmpNew = Nothing

When I run this, the picturebox image is resized... but is totally black! What the heck am I missing... or is there a better way to resize the picturebox picture?

Thanks in advance!

Resizing Picture
Hi Friends,
Again here with a new problem, might be easy to solve but i tried it very hard,

the problem is that my application has lots of pics of varring sizes, i have to show them according to the actions by the user.

i have used picture box, image control but every where i can just resize the controls not the picture according to my display space.

Can anybody suggest me how to shrink the picture in my application according to the size, or any other way to do that


Picture Resizing
I am trying to load a large picture into a small picture box,
and right now it just crops off about 3/4 of the picture.
I would like to have the picture resized, and then if the user
clicks on the picture another form opens with the larger picture.

Any help would be greatly appreciated.

Picture1.Picture = LoadPicture("C:VB_sample_drawing_typesimagesarea_asmall.gif")

Resizing Picture...
i need some help resizing that picture but the thing is i dont wanna scale it like windows picture viewer... i wanna scale from middle.. can anybody help me ?

Resizing A Picture.
Is there any easy way to resize a picture to make it fit into a window? I have my picture in a picturebox, and I wish to paste it onto the main form as a background, but I want it to fill the entire screen. I can't tile it as it's a single large picture and won't tile properly. Is there some sort of stretch function? Obviously the alternative would be to resize it in a paint program, but I want my program to run on any resolution.

Resizing Picture
hi all,
I need some help here. I have an imagebox and properties stretch = TRUE but the picture is not clear and poor quality.

any ideas?

i view My Pictures in Window XP. No matter how i shrinking the picture but still very clear. How to do that? izit very complicated?

i got this example:

Resizing The MDI Picture
I've added a picture to the MDI I've made, but I'm having problems resizing it... if I use a picturebox and its paintpicture method it takes a sh*tload of resources, so I thought of using StretchBlt, but again, I'm having problems with this method, and I don't manage to get it working properly. Can anyone help me out?

Thanks in advance.

Picture Box Resizing
I have three (3) picture boxes (named pbFrame) in a control array (1, 2 and 3). They are arranged with one on top of the other and thier left properties are the same. When the form is resized I what pbFrame(1)'s height to remain constant but I want pbFrame(2) and pbFrame(3) to be resized to the ScaleHeight of the form, but this is where I crash and burn, because in the following resize code will leave a small gap on the bottom of the screen when I resize, see graphic:

Option Explicit

Private sngHeightPrecent(3) As Single
Private a As Long
Private lngTop As Long

Private Sub Form_Load()

For a = 1 To pbFrame.Count '<==Edit removed - 1
With pbFrame
With .Item(a)
.Height = Choose(a, ScaleHeight * 0.06, ScaleHeight * 0.46, ScaleHeight * 0.46)
' Sets up initial Control Heights

.Width = Choose(a, ScaleWidth, ScaleWidth, ScaleWidth)
.Tag = Choose(a, "SizeWidthOnly", "SizeBoth", "SizeBoth")
sngHeightPrecent(a) = Format(.Height / ScaleHeight, "#.0000")
End With
End With
Next a

Call ResizeFrames
End Sub

Private Sub ResizeFrames()
On Error GoTo ResizeFrames_Error

For a = 1 To pbFrame.Count '<==Edit removed - 1
With pbFrame
With .Item(a)
.Top = Choose(a, 0, lngTop, lngTop)
.Left = 10
lngTop = .Top + .Height

Select Case .Tag
Case "SizeWidthOnly"
.Width = ScaleWidth
Case "SizeHeightOnly"
.Height = Choose(a, .Height, ScaleHeight * sngHeightPrecent(a), ScaleHeight * sngHeightPrecent(a), ScaleHeight * sngHeightPrecent(a))
Case "SizeBoth"
.Height = Choose(a, .Height, ScaleHeight * sngHeightPrecent(a), ScaleHeight * sngHeightPrecent(a), ScaleHeight * sngHeightPrecent(a))
.Width = ScaleWidth
Case Else
End Select

sngHeightPrecent(a) = Format(.Height / ScaleHeight, "#.0000")

End With
End With
Next a

On Error GoTo 0
Exit Sub


MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ResizeFrames of Form frmMainMenu"

End Sub

Private Sub Form_Resize()
Call ResizeFrames
End Sub


Resizing A Picture Box
Is there a way to resize a picture box and everything inside it. Whether or not this can be done at design time or run time I dobnt mind


Resizing A Picture
Ok, I have a picture box, picture1 which has a picture loaded into it when the user wishes. The problem is I need to resize (rescale) every picture so it fits into the standard picture1 box set to 200x260 pixels.

I have tried to set the picture.scaleheight and scalewidth properties to accomodate this but dont seem to be doing anything.

Im only a beginner so any ideas??


Resizing Picture
Hi Friends,
Again here with a new problem, might be easy to solve but i tried it very hard,

the problem is that my application has lots of pics of varring sizes, i have to show them according to the actions by the user.

i have used picture box, image control but every where i can just resize the controls not the picture according to my display space.

Can anybody suggest me how to shrink the picture in my application according to the size, or any other way to do that

Resizing A Picture.
I have no idea how hard/easy this is, but i would like to be able to do what an imagebox does without using an imagebox.

What i mean is the Stretch property. On my usercontrol i have the abbility to add a background picture. I would like to be able to size/stretch that picture to the size of the control.

Is this possible within reason?

Pic Resizing In Picture Box
Hi everybody, how can i do this ?

Without resize picture box, resize the picture to put him
completly inside picture box.
Now center picture according shorter width ou height dim.


Picture Resizing
Hi all,
I have an application that requires me to load an image into
a picture or image or picclip control.Picture will be JPG format
and of size 800 X 600 pixels. It will be displayed as say, 200 X 100
pixels. Question: Is it possible to save the image as a 200 X 100 image,
or can I only save it as 800 X 600?
I have tried, using a picture control, 'SavePicture Picture1.Picture,
which does not save the resize the image.
Any pointers or help would be gratefull.


Resizing Picture Box
hi all,
how to tresize picture box at run time
using mouse.

Resizing A Picture
I'm designing a program that receives pictures in psp(paint shop pro) format,
changes its size and save it with its new size.How is it possible?

Resizing Picture
I have encountered a problem. I have placed a picture on a midiform. My Pc resolution is 800X600.The midiform is maximized, the picture coverd my whole screen during runtime.

But when the program is run at another pc with different resolution, the picture covered only the left part of the screen.

Is there a way that i can make sure that whatever the resolution is, the picture on my midiform can fill up the whole screen?

Thanks a lot!

Picture Resizing
Okay, I'm trying to make this slideshow thing and if the pictures are bigger than the screen then I have them resized by using this code . . .

'If width is to big resize and use the ratio to find the height

If Image1.Width &gt; Form1.Width then
Ratio.Text = Form1.Width / Image1.Width
Image1.Stretch = true
Image1.Width = Form1.Width
Image1.Height = Image1.Height * Ratio.Text
End If

'If height is to big resize and use the ratio to find the width

If Image1.Height &gt; Form1.Height then
Ratio.Text = Form1.Height / Image1.Height
Image1.Stretch = true
Image1.Height = Form1.Height
Image1.Width = Image1.Width * Ratio.Text
End If

Now this works great untill I get a picture that is both too wide and to tall. Any suggestions?

Thanks, Nathan Plumley

Resizing A Picture On Import
I am importing a picture that needs to be resized to fit a picture box. I know I could use autosize, but that will not work in this instance. Does anyone know of a way to actually change the dimensions of a picture right after the user selects the picture to import to a specific size, such as 100 x 100. The code I currently have is below. Any help is greatly appreciated! Oh, and I'm using .net.
Private Sub btnPic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPic.Click
'Open dialog box to import a picture

With ofd
.CheckFileExists = True
.CheckPathExists = True
.Filter = "Images|*.bmp;*.tiff;*.jpg;*.jpeg;*.png;"
.Multiselect = False
.ShowHelp = False
.Title = "Select an Image"
End With

If ofd.ShowDialog() = DialogResult.OK Then
Dim tmpBMP As New Bitmap(ofd.FileName)
CoverPic.Image = tmpBMP
End If
End Sub

Resizing Picture On A Sstab
Hi you all,

First i have a picture on a sstab and i am trying to load an image but i can not resize the image to fit on the picturebox.
second, Sometimes under the picture it is also possible to see a part of a protoviewlist that is on another tab and i do not why.

Any help will be apreciated! Thanks!

Help! Picture Cropping/Resizing?
Hi all,

I've been playing around in VB and come up with a project to do, problem is... I'm stuck on something.

My application works fine except when I want to save a screenshot of the app it doesnt work, the screenshot loads to a picture box without trouble and I can save the image.

From this image, i want to remove everything apart from the dialogue in the top left corner (fixed size) and save only the the top (eg paint - see screenshot).

I've found some API i can use to ONLY capture the actual form but it doesnt work since i'm using MDI parent/child forms.

Please help, very annoying

[Sorry if i'm not making myself clear, its late here.]

- Edit, i've also tried using SendKeys to do Alt + PrintScreen but i've had no such luck.

Resizing Picturebox To Fit Picture
When I use Loadpicture("whatever.jpg") in a picturebox, how can I get the picture box to automatically resize to the width and height of whatever.jpg?


Resizing Picture Files.
If I want to write a program that will resize and save photos of all common types (bmp, jpg, gif) what should I look into? Also (this has to do with the program i have in mind) how would one gather info on a file such as date modified and dimensions of a photo? I'm not looking for code just general areas to look into.

Resizing Images Before They Hit The Picture Box
With the click of a button I am cycling through several different pictures in my project. All of these pictures are roughly the same shape and size, however, they do differ slightly from time to time. How would I go about resizing the image before I put it into the picture box with pre-set dimensions (without physically resizing it in Photoshop or other image editors)?

Thanks all,

How To Put A Picture Into Richtext Box With Non-resizing?
I can put a picture into richtext box like MSN but It always be resized. How to disable it?

Resizing Background Picture
Hi people, thanks for your help earlier (much appreciated)..

However I'm stuck again.....

I have a form with a background picture, but want to make the form resizeable, in turn I'll have to move some of the items in the form. I think I can manage that, if I get my finger out, but....

My main question is... how can I make the background image stretch or shrink to fit the form?

Resizing Picture Control
I have a form Form1 and a PictureBoxControl above the Form. I also have a vertical and horizontal scroll bar in the form. There is also a toolbar in the form with menubutton. Each menu button when pressed will show a picture above the pictureBox Control. I am trying to implement the scrollbar in the picturecontrol. However everytime the scrollbar goes beyond the picturecontrol box into the Form1. I know it is very difficult to understand what I am trying to say and hence I am attaching three pictures to represent my problem.
The code I am using to resize picturebox and scrollbar and forms is as follows:
Sub AlignScrollBars()
BigPicture.Height = Form1.Height
BigPicture.Width = Form1.Width
BigPicture.ScaleHeight = Form1.ScaleHeight
BigPicture.ScaleWidth = Form1.ScaleWidth
HScroll.Width = BigPicture.ScaleWidth - VScroll.Width
VScroll.Height = BigPicture.ScaleHeight - HScroll.Height
HScroll.Left = 0: HScroll.Top = BigPicture.ScaleHeight - HScroll.Height
VScroll.Top = 0: VScroll.Left = BigPicture.ScaleWidth - VScroll.Width

HScroll.Max = BigPicture.Width
VScroll.Max = BigPicture.Height

' Reposition the PictureBox
BigPicture.Top = (-1 * VScroll) + 660
BigPicture.Left = (-1 * HScroll)

Picture Box Resizing (RESOLVED)

is there any code that we can small the picture and the resulotion is kept? and we can put it on a standard size picture box, I want to have a review of a big picture, like making a thumbnail size.

thanks for your help

Resizing Picture (not Image) -
I'm trying to reduce the size of a picture - scaled down for using the get pixel api. I know how to do this with an image - setting stretch to true. It loads as I would want it as an image like this, but I don't know if there is a way to do this using a picture box? If I do the same on a picture box, it doesn't resize just shows a portion of the picture...

I want to use getpixel and I'm thinking of reducing the image size so that my computer can crunch all pixels within the image - my computer won't do much over 100 x 100 pixels.

Thanks for any help!

Resizing A Picture Box To Contain Text
i have a picture box, in which i print a lot of text lines. Basically the number of lines i print depends on a variable!

I want the picbox to resize in height so that it can contain all those text lines, but don't know how to do it????

e.g. if i know that i have 20 lines how do i change the size??? (the font size is at the default!!)

Please help!!!


Resizing A Picture Box Over The Whole Form
How would I resize a picture box over the whole form (width, height of the picture box is equal to the width and height of the form)? The Scalemode is both, the form and the picture box, is set the vbPixels.

I Need Help Resizing The Picture On My Form
is it possible to resize a picture so that it is always one inch from the right of the end of the form, and three inches from the left of the form. this will mean that no matter what resolution you have, the picture always is placed where you want it on the form.



Resizing Bitmaps To Fit The Picture Box
Is it possible to resize the bitmaps to fit the fixed size of the picture box without having to manually resize every bmp.

Resizing Picture And Frame

This is my problem.
I have a slideshow program
I am making.The pictures
that appear in the slideshow are
to big to fit the screen.
I want the pictures that appear
to be about 2/3 of the screen.width

So could someone give me the
code to resize the PICTURE that
is in the frame, not just the
frame width and height.


[Edited by Dayo312 on 06-15-2000 at 05:29 PM]

Resizing Picture Boxes
Hi All,

I'm trying to resize a picture box to a particular size (in pixels). In theory, what I need to do is this :

Picture.Height = Picture.ScaleY(NewHeight, Picture.ScaleMode, vbPixels)
Picture.Width = Picture.ScaleX(NewWidth, Picture.ScaleMode, vbPixels)

or I should be able to multiply the NewHeight or NewWidth by Screen.TwipsPerPixelX / Y. Both give me inaccurate results!

Screen.TwipsPerPixel returns (as far as I can see) an integer (15 on my machine). Setting scaleMode to vbPixels on the picture box and manually resizing until I get a 100 pixel high box gives a 1560 high twip box. This would seem to indicate that twips per pixel is rounded (odd numbers round down remember) to the nearest integer. Is there a better way to do this??? I've tried everything I can think of to get the damn thing to work but it always seems to give me the wrong size. Any help will REALLY be appreciated!


Resizing A Picture In Excel From VB
I can insert a picture into excel from VB, but when I try to use selection.shaperange.height = y, I get an "ActiveX component can't create object" error. Am I missing something?

Resizing A Form's Picture
I have a form with a picture on it (not a picture box, a picture as one of the properties of the form). How can I have the picture stretch itself when the size of the form changes?

Resizing Picture Of Controls?
Is there a way to resize the picture of user controls (or any other controls except Image) to fit the size of the control? Or to let the control auto resize itself to the size of its picture?

Edited by - Chimera on 8/15/2002 6:38:22 AM

Resizing The Picture Box At Run Time?

 i have one picture box in my form. i am displaying some images on that. so how can i give the option to the user that he resize the picture box depends the image size. generally the size will be constant. but how can give the chance to the user so that he can able to resize the picture box depends on his idea.

plz help me.


Resizing A Picture In Word
I have put a picture into a word file using VB. However, the size of the picture in the word file is not situable for me. I want to resize it while not changing the size of the orginal picture file. How can I do this?

Resizing Image In Picture Box
Hi all

How can I resize a image to 50%, 75%, 152%, 150% ... fit to window options in a picture box . I use the pictute box control, not the image control because my picture is not really a picture. I draw it on a specified scale from the data base that I use. In the data base I memorise every pixel that will apear in the picture.
And how can I use scrool bars to view the image after a zoom out?

I wanted to do this because I have zoom in/out images made from the data bases.

Thanks in advance

Multiple Picture Resizing In Word
Hi, I am trying to resize all the pictures in my vast Word documents to set sizes depending on the style of the paragraph they belong to. The following word macro code I have created works absolutly beautifully for about 3/4 of the pictures however for some reason the other quarter end up completly distorted, with one dimension many times larger than the other. When I manually follow the same procedure as the macro on these pictures using the format picture dialog box, it works fine! Does anyone know why the macro is not working on some of these pictures? They are all just standard screenshots copied and pasted into word.

Dim objDoc As Document
Dim oPic As InlineShape

Set objDoc = ActiveDocument
Application.ScreenUpdating = True

For Each oPic In objDoc.InlineShapes
Select Case oPic.Range.Style
Case "Instruction"
If oPic.Width > 250 Then
With oPic
.LockAspectRatio = msoTrue
.Width = 250
.ScaleHeight = .ScaleWidth
End With
End If
Case "Bullet", "Bullet Last", "Pic Indent", "Pic Indent keep with next"
If oPic.Width > 200 Then
With oPic
.LockAspectRatio = msoTrue
.Width = 200
.ScaleHeight = .ScaleWidth
End With
End If
Case Else
End Select
Next oPic
End Sub

Resizing A Form And Webbrowser To A Picture
To make a confusing problem short - heres the jist:
I have a Webbrowser viewing a set of pictures online. What I want to do is resize the webbrowser to fit the picture when it is loaded and then make the form the size of the webbrowser plus some.

Resizing A Picture And Saving It In That Resolution
Hi All {Again }

I am helping my father with his website. He wants to have a photo page on it. I said I'd help him with that but I came across a problem:
I need to make thumbnails of all pictures
Is there any way I can resize pictures (JPG) and save them in smaller resolutions?


Resizing A Picture Inside A Picturebox...

I am currently displaying pictures inside a picturebox. Now i want to zoom in and out the picture (50% bigger and smaller) Somehow i dont get it to work, NOT using an imagecontrol.

Thats my code

Picture1.Visible = False
Picture1.AutoSize = False
Picture1.Width = Picture1.Width * 1.5
Picture1.Height = Picture1.Height * 1.5
Picture1.Move (Me.Width / 2) - (X * 2), (Me.Width / 2) - (Y * 2)
Picture1.Visible = True


Copyright 2005-08, All rights reserved