object doesn't support this property or method

B

BenB

i'm getting the error

run-time error '438':
Object doesn't support this property or method

however the object i'm intending to use does have the property that causes
the error. The problem only occurs when i run two macros following one
another.

The first utilizes an msoFileDialogFolderPicker (which does not have the
property .Filters.Add) and the second utilizes an msoFileDialogOpen (which
does have the property .Filters.Add). I'm suspecting i have not closed the
msoFileDialogFolderPicker properly and it is referring to that instead of my
msoFileDialogOpen in the second macro... a portion of both macros is below...

thanks.






Sub SetDatabaseFolder()
Dim DatabaseFolder As String
Dim FilePath As String
Set dlgOpen = Application.FileDialog(msoFileDialogFolderPicker)
With dlgOpen
.AllowMultiSelect = False
.Filters.Clear
.Title = "Select Folder to set as Database Folder"
If .Show = -1 Then
DatabaseFolder = .SelectedItems(1)
' Set customdocument property named databasefolder to folder
that was selected
If IsDatabaseFolderDefined Then

Application.ActivePresentation.CustomDocumentProperties("databasefolder").Delete
Application.ActivePresentation.CustomDocumentProperties.Add
Name:="databasefolder", LinkToContent:=False, Type:=msoPropertyTypeString,
Value:=DatabaseFolder
Else
Application.ActivePresentation.CustomDocumentProperties.Add
Name:="databasefolder", LinkToContent:=False, Type:=msoPropertyTypeString,
Value:=DatabaseFolder
End If
MsgBox ("DatabaseFolder set to " + DatabaseFolder)
End If
End With
End Sub




Sub CopyWithSourceFormattingEnd(DatabaseFolder As String)
Dim oSource As Presentation
Dim oTarget As Presentation
Dim oSlide As Slide
Dim dlgOpen As FileDialog
Dim bMasterShapes As Boolean
Dim SlideCount As Integer
Set oTarget = ActivePresentation
Set dlgOpen = Application.FileDialog(msoFileDialogOpen)

With dlgOpen
.AllowMultiSelect = False
.Filters.Clear
.InitialFileName = DatabaseFolder
.Filters.Add "Presentations", "*.ppt,*.pps"
.Title = "Select Presentation to import"
If .Show = -1 Then
Set oSource = Presentations.Open(.SelectedItems(1), , , False)
End If
If oSource Is Nothing Then Exit Sub
' SlideCount = oSource.Slides.Slide
End With
 

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