kukaljcanin
New Member
- Joined
- May 30, 2023
- Messages
- 1
- Office Version
- 2021
- 2019
- Platform
- Windows
I have an Excel document only 2 columns
One is Name of th
e link other it was the link it's self. I am trying to extract all the links in the cells and create .M3u8 files for each link but the naming should be from the the column 1. The excel sheet looks like this but the links are different
What i want is to create news01.m3u8 with the url link found in link.
And like this for every row a file should be greater with the name and link in it. News02/News03.m3u8
I have to his code but it's not ok, any help would be nice
*********
Sub CreateM3U8Files()
Dim linkRange As Range
Dim linkCell As Range
Dim filePath As String
Dim fileNumber As Integer
' Set the range of cells containing the links
Set linkRange = Range("A1:A10") ' Modify this range according to your needs
' Assumes column A contains the links
' Set the folder path where the .m3u8 files will be saved
filePath = "C:\Folder\" ' Modify this path according to your needs
' Loop through each cell in the range
For Each linkCell In linkRange
' Retrieve the link value
Dim link As String
link = linkCell.Value
' Retrieve the corresponding name from the preceding cell
Dim name As String
Dim nameCell As Range
Set nameCell = linkCell.Offset(0, -1)
name = nameCell.Value
' Create a new .m3u8 file for each link
fileNumber = FreeFile
Open filePath & name & ".m3u8" For Output As fileNumber
' Write the link to the file
Print #fileNumber, link
' Close the file
Close fileNumber
Next linkCell
MsgBox "M3U8
files created successfully."
End Sub
*******
One is Name of th
e link other it was the link it's self. I am trying to extract all the links in the cells and create .M3u8 files for each link but the naming should be from the the column 1. The excel sheet looks like this but the links are different
Name | link |
News 01 | |
News 02 | |
News 03 |
What i want is to create news01.m3u8 with the url link found in link.
And like this for every row a file should be greater with the name and link in it. News02/News03.m3u8
I have to his code but it's not ok, any help would be nice
*********
Sub CreateM3U8Files()
Dim linkRange As Range
Dim linkCell As Range
Dim filePath As String
Dim fileNumber As Integer
' Set the range of cells containing the links
Set linkRange = Range("A1:A10") ' Modify this range according to your needs
' Assumes column A contains the links
' Set the folder path where the .m3u8 files will be saved
filePath = "C:\Folder\" ' Modify this path according to your needs
' Loop through each cell in the range
For Each linkCell In linkRange
' Retrieve the link value
Dim link As String
link = linkCell.Value
' Retrieve the corresponding name from the preceding cell
Dim name As String
Dim nameCell As Range
Set nameCell = linkCell.Offset(0, -1)
name = nameCell.Value
' Create a new .m3u8 file for each link
fileNumber = FreeFile
Open filePath & name & ".m3u8" For Output As fileNumber
' Write the link to the file
Print #fileNumber, link
' Close the file
Close fileNumber
Next linkCell
MsgBox "M3U8
files created successfully."
End Sub
*******