R
Roderick O'Regan
Recently, I've had a lot of help from MVP's (and very grateful I am, too) as
well as reading from VBA help. This allowed me to create a procedure to open
a dialog box from which I could insert a picture. However, this only works
in PP 2002 upwards.
I now need to create the same thing to work in PP97 and 2000.
So I went back to VBA help in PP and found that the routine below added the
appropriate buttons to a floating toolbar called "Custom":
Dim customBar As CommandBar
Dim newButton As CommandBarButton
Set customBar = CommandBars.Add("Custom")
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Cut").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Copy").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Paste").Id)
customBar.Visible = True
Tested the above in PP 2000 and it worked perfectly!
So, following the same principle as above I added another few lines as
follows:
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Insert") _
.Controls("From File...").Id)
customBar.Visible = True
The "From File..." wording of the control I took from the
Customize|Commands|Insert list. It failed when tested. With error number 5.
I replaced "From File..." with "Save As..." (same structure) and that worked
perfectly. The Save As... dialog box opened.
Is there anyone, please, who could tell me how to open - programmatically in
VBA in PP 97 - a dialog box to choose and then insert a picture into a
slide?
I've chased around all the FAQ sites for answers but to no avail. I'm
beginning to think it's impossible to do!
Regards
Roderick O'Regan
well as reading from VBA help. This allowed me to create a procedure to open
a dialog box from which I could insert a picture. However, this only works
in PP 2002 upwards.
I now need to create the same thing to work in PP97 and 2000.
So I went back to VBA help in PP and found that the routine below added the
appropriate buttons to a floating toolbar called "Custom":
Dim customBar As CommandBar
Dim newButton As CommandBarButton
Set customBar = CommandBars.Add("Custom")
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Cut").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Copy").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Paste").Id)
customBar.Visible = True
Tested the above in PP 2000 and it worked perfectly!
So, following the same principle as above I added another few lines as
follows:
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Insert") _
.Controls("From File...").Id)
customBar.Visible = True
The "From File..." wording of the control I took from the
Customize|Commands|Insert list. It failed when tested. With error number 5.
I replaced "From File..." with "Save As..." (same structure) and that worked
perfectly. The Save As... dialog box opened.
Is there anyone, please, who could tell me how to open - programmatically in
VBA in PP 97 - a dialog box to choose and then insert a picture into a
slide?
I've chased around all the FAQ sites for answers but to no avail. I'm
beginning to think it's impossible to do!
Regards
Roderick O'Regan