Hi,
I'm trying to find the easiest way to automatically download and save an MP3
Below is where I am up to and the approximate way I was hoping to approach this.
Any assistance would be really appreciated as I'm stuck. A lot of the solutions online seem very over engineered and complex and I'm sure there must be a more concise way.
Private Sub OnTimer()
'A checkbox which stops the on timer event running the commands below when unchecked
if [CheckGo] = false
Exit sub
End if
'stops process when there are no more records
if isnull (me.RecordID) Then
Exit sub
End if
'Declares instances of internet explorer (not sure if this is needed
Set ie = New InternetExplorer
ie.Visible = False
'Variables for URL, directory to save file and file name plus file type
Dim rURL, rFilePath, rFilename As String
'Values for variables
rURL = [rCurrentURL]
rFilePath = "D:\myfilepath\directory\"
rFilename = [rCurrentName] & ".mp3"
'Parses URL to ie
ie.navigate rURL
'Makes sure ie has fully loaded before next proceedure
While ie.Busy
DoEvents
Wend
While ie.Document.ReadyState <> "Complete"
DoEvents
Wend
-----------------------------------------------------------------------------------------------------------
This is the part that I cannot find a solution for
When I open the URL the audio file just plays automatically which I don't want or need to happen
What I could do with please is a section of code that will automatically download the audiofile to the file location I've declared and save this with the name specified
I need to avoid any sort of prompt that would need to be manually handled (IE a save confirmation notice)
I've looked online and can't find anything that seems to work
-----------------------------------------------------------------------------------------------------------
'A couple of form control fields are stamped to confirm completion of process
[DownloadComplete] = "Yes"
[DownloadStamp]= Now()
'The form moves forward one record
DoCmd.GoToRecord acDataForm, "MyForm", acNext
'End of process
End sub
'repeats
I'm trying to find the easiest way to automatically download and save an MP3
Below is where I am up to and the approximate way I was hoping to approach this.
Any assistance would be really appreciated as I'm stuck. A lot of the solutions online seem very over engineered and complex and I'm sure there must be a more concise way.
Private Sub OnTimer()
'A checkbox which stops the on timer event running the commands below when unchecked
if [CheckGo] = false
Exit sub
End if
'stops process when there are no more records
if isnull (me.RecordID) Then
Exit sub
End if
'Declares instances of internet explorer (not sure if this is needed
Set ie = New InternetExplorer
ie.Visible = False
'Variables for URL, directory to save file and file name plus file type
Dim rURL, rFilePath, rFilename As String
'Values for variables
rURL = [rCurrentURL]
rFilePath = "D:\myfilepath\directory\"
rFilename = [rCurrentName] & ".mp3"
'Parses URL to ie
ie.navigate rURL
'Makes sure ie has fully loaded before next proceedure
While ie.Busy
DoEvents
Wend
While ie.Document.ReadyState <> "Complete"
DoEvents
Wend
-----------------------------------------------------------------------------------------------------------
This is the part that I cannot find a solution for
When I open the URL the audio file just plays automatically which I don't want or need to happen
What I could do with please is a section of code that will automatically download the audiofile to the file location I've declared and save this with the name specified
I need to avoid any sort of prompt that would need to be manually handled (IE a save confirmation notice)
I've looked online and can't find anything that seems to work
-----------------------------------------------------------------------------------------------------------
'A couple of form control fields are stamped to confirm completion of process
[DownloadComplete] = "Yes"
[DownloadStamp]= Now()
'The form moves forward one record
DoCmd.GoToRecord acDataForm, "MyForm", acNext
'End of process
End sub
'repeats