Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'module 1:
- Public Function Notepad(sFile As String) As String
- 'Debug.Print "File: " & sFile
- Notepad = "file.txt"
- End Function
- 'module 2:
- Sub ViewModel_Click()
- Dim sLdCad As String, sFile
- sFile = ActiveCell.Value
- If Right(sFile, 4) = ".dat" Then
- sLdCad = ActiveSheet.Range("B1").Value
- 'MsgBox (sLdCad & "\" & sFile)
- Shell ("cmd /c " & sLdCad & "\" & sFile)
- Else
- MsgBox ("Must click on a .dat cell before clicking on this button")
- End If
- End Sub
- Sub EditModel_Click()
- Dim sLdCad As String, sFile
- sFile = ActiveCell.Value
- If Right(sFile, 4) = ".dat" Then
- sLdCad = ActiveSheet.Range("B1").Value
- Shell ("cmd /c start notepad """ & sLdCad & "\" & sFile & """")
- Else
- MsgBox ("Must click on a .dat cell before clicking on this button")
- End If
- End Sub
- 'module 3:
- Sub InsertImagesFromURLs()
- Dim cell As Range
- Dim img As Picture
- Dim imgURL As String
- Dim targetCell As Range
- ' Loop through each cell in column B with a URL
- For Each cell In Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row)
- imgURL = cell.Value
- If imgURL <> "" Then
- ' Insert the image
- Set img = ActiveSheet.Pictures.Insert(imgURL)
- ' Set the target cell for the image placement (same as the cell in column B)
- Set targetCell = cell
- ' Position and size the image within the cell
- With img
- .ShapeRange.LockAspectRatio = msoFalse
- .Left = targetCell.Left
- .Top = targetCell.Top
- .Width = targetCell.Width
- .Height = targetCell.Height
- End With
- End If
- Next cell
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement