I have some code that is giving me a RUn time Error: Slides (unknown member): Failed
It happens on this line:
ActivePresentation.Slides.InsertFromFile Environ$("USERPROFILE") & "\Downloads\" & FileContent & ".pptx", 1, 1, 26
Sub Finish()
Dim URL1 As String
Dim URL2 As String
Dim TextFile As Integer
Dim FilePath As String
Dim FileContent As String
Dim FileDownload As String
Dim i As Long
'File Path of Text File
FilePath = GetDownloadsPath & "\" & "Category Review BUCategory.txt"
' MsgBox FilePath
'Determine the next file number available for use by the FileOpen function
TextFile = FreeFile
'Open the text file
Open FilePath For Input As TextFile
'Store file content inside a variable
FileContent = Input(LOF(TextFile), TextFile)
'Close Text File
'Close TextFile
' MsgBox FileContent
FileDownload = GetDownloadsPath & "\" & FileContent & ".pptx"
'MsgBox FileDownload
ActivePresentation.Slides.InsertFromFile Environ$("USERPROFILE") & "\Downloads\" & FileContent & ".pptx", 1, 1, 26
'Delete Text File
' Kill FileDownload
End Sub
My GetDownloadsPath function is:
Function GetDownloadsPath() As String
GetDownloadsPath = Environ$("USERPROFILE") & "\Downloads"
End Function
Any ideas how to correct?
Bookmarks