Image insert with macro

  • Thread starter Thread starter homokyz
  • Start date Start date
H

homokyz

PLEASE HELP dear everyone. I have used the following macro to add
image from slide show view:

Private Sub CommandButton1_Click()
Application.CommandBars("Menu Bar") _
..FindControl(Id:=2619, Recursive:=True).Execute
Application.WindowState = 2

End Sub

I'm looking for an option to add the subrutine to position the image
instead of automaticly align to the slide center.

THANK YOU FOR YOUR HELP IN ADVANCE.
B
 
The code you have runs the Insert Picture from file dialogue which I think
will always target screen center. You could use instead

Private Sub CommandButton1_Click()
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddPicture _
"C:\Documents and Settings\John\My Documents\ff.png", msoFalse, _
msoTrue, 50, 60
DoEvents
End Sub
Obviously change the file path. The 50 and 60 are Top and Left for the
inserted pic
 
PLEASE HELP dear everyone. I have used the following macro to add
image from slide show view:

Private Sub CommandButton1_Click()
Application.CommandBars("Menu Bar") _
..FindControl(Id:=2619, Recursive:=True).Execute
Application.WindowState = 2

End Sub

I'm looking for an option to add the subrutine to position the image
instead of automaticly align to the slide center.

This'll help you insert the picture w/o distorting it, once you know the name
of the file you want to insert:

Insert a picture at the correct size
http://www.pptfaq.com/FAQ00329.htm

You can add code to set the picture's .Left and .Top properties to whatever you
like.
 
I found your last post

You will need this if you want to browse

Sub Pics()

Dim strPath As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
..Filters.Clear
..Filters.Add "Pictures", "*.jpg,*.png" ' more if you want!
If .Show = -1 Then
strPath = .SelectedItems(1)
End If
End With

ActivePresentation.SlideShowWindow.View.Slide.Shapes _
..AddPicture strPath, msoFalse, msoTrue, 50, 60 '50 is Top, 60 is left position

Set fd = Nothing

End Sub

Regards John
 
I found your last post

You will need this if you want to browse

Sub Pics()

Dim strPath As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Filters.Add "Pictures", "*.jpg,*.png" ' more if you want!
If .Show = -1 Then
strPath = .SelectedItems(1)
End If
End With

ActivePresentation.SlideShowWindow.View.Slide.Shapes _
.AddPicture strPath, msoFalse, msoTrue, 50, 60 '50 is Top, 60 is left position

Set fd = Nothing

End Sub

Regards John
--
Amazing PPT Hints, Tips and Tutorials-http://www.PPTAlchemy.co.ukhttp://www.technologytrish.co.uk
email john AT technologytrish.co.uk









- Show quoted text -

This is excelent, thank you very much, just a short question, is it
possible to do in slide show view, without changing the view after
running the macro.

Thank you for your answer in advance, best regards, Zoltan
 

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