Error message "object variable or with block varible not set".

T

tiger

Hi,

I have the following VBA code for PowerPoint.....and I this error message
"object variable or with block varible not set".
Sub InsertAndSizePicture()Dim oPicture as ShapeDim FullPath as String ' Set
this to the full path to picture..FullPath ="C:\My
Documents\Pictures\MyPhoto.JPG" ' Insert the picture at an arbitrary size;
PowerPoint requires you to supply *some* height and width for the pictureSet
oPicture = ActiveWindow.Selection.Shapes.AddPicture (Filename:=FullPath,
_LinkToFile:=msoFalse, _SaveWithDocument:=msoFalse, _Left:=0, Top:=0,
_width:=100, height:=100) ' Rescale the picture to its "natural" slzeWith
oPicture .Scaleheight 1, msoTrue .Scalewidth 1, msoTrueEnd
with Set oPicture = NothingEnd SubThanks
Tiger
 

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

Top