PDA

View Full Version : VBA: Displaying the Template Gallery



bwells
05-19-2006, 06:38 AM
Hey wats up all. Im designing my own form(pretty much a custom wizard), and what I'm tryin to do is get the (or a) template gallery to display so the users can pick the template they prefer. I can already change templates through a radio button or command button, but I want the gallery to show up so the users, who don't know powerpoint, can see the thumnails and apply a template.

I don't know if this is possible but is there any way to do this or something like it?

Thanks ahead of time.

Killian
05-19-2006, 07:00 AM
Hi and welcome to VABX :hi:

Do you want to display installed templates on the userform or just activate the Slide Design task pane? (I can't remember how there are accessed in 97 - that would have to be considered)

bwells
05-19-2006, 07:54 AM
Probally just the design pannel. So when they click a button it pops up

Killian
05-19-2006, 08:44 AM
Well it would be nice if it were easy but I'm not so sure...

Office 2002 (XP) introduced the "Task Pane" which looks nice but has poor accessability for humans and code. It is a Commandbar object so you can display it withCommandBars("Task Pane").Visible = TrueUnfortunately, you can't switch the view to the one you want. AFAIK, the only thing you can do is add a new file in the "New Presentation" pane.

97 and 2000 will be a different prospect but I don't have access to them at the moment. (I've had to rebuild my PC and haven't got round to installing Virtual PC yet - will be next week tho, I've got some testing to do)

Hope that's some help

bwells
05-19-2006, 08:49 AM
ok, but that command will online show it in the background in the deafult position..so i guess its one of those things we can't get to?

Killian
05-19-2006, 04:38 PM
so i guess its one of those things we can't get to?I can't find any way into it so it looks that way.

I guess if you've already got a custom wizard going and you can reliably find a path to your user's template directory, it would be quite simple to display them as a step in the process..?

bwells
05-23-2006, 05:22 AM
Oh alright thanks alot.

bwells
05-23-2006, 08:20 AM
New twist to the questions, is there way to invoke the browse option that shows up in the Template pane? I can do this operation for options that are in the tool bar. For example click the save button and the save as window appears, but now i was to do the browse button at the bottom of the Temaple pane? Have you ever heard of such a time or is it possible?

lucas
05-23-2006, 10:11 AM
This may be a start for you....from the help files:

Sub ShowFileDialog()
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
Type:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
End Sub

bwells
05-24-2006, 06:19 AM
Ok nice, Im going to try that. Once thing I did yesterday was automatically generate the names of all the .pot files in the template folder, and put them in a drop down box. I have that working. The only thing is i need to modify the name that shows up in the menu. Its showing Balance.pop rather than just balance. If you have any ideas on doing this i accept help..hahah. Thanks for the help

Killian
05-24-2006, 06:29 AM
You could assume your filename has a 3 letter extension and just take off the last 4 characters'where strName is holding the filename
strName = Left(strName, Len(strName) - 4)or you could use more defensive programming and check firstp = InStrRev(strName, ".")
If p <> 0 Then strName = Left(strName, p - 1)

bwells
05-24-2006, 06:55 AM
Thanks alot. I used the more defensive programming aproach.