Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Add multiple excel worksheets(tabs) with jpgs
I have several jpgs that have to be inserted into each separate
worksheet. Is it possible to batch this along with naming the worksheet tabs the jpg name? Regards Sunny |
#2
|
|||
|
|||
This macro should do the job. Place all your .jpg files
into a new folder. Make sure to change "sPath" to your path and correct folder name (mine is named "thejpgs"). Sub Insert_JPG() Dim sPath As String Dim NewWS As Worksheet Dim PathArray As Variant Dim FileName As String sPath = "C:\Documents and Settings\jmorin\Desktop\thejpgs" With Application.FileSearch .NewSearch .LookIn = sPath .SearchSubFolders = False .FileName = "*.*" .FileType = msoFileTypeAllFiles If .Execute() 0 Then For i = 1 To .FoundFiles.Count PathArray = Split(.FoundFiles(i), "\") FileName = PathArray(UBound(PathArray)) Set NewWS = Sheets.Add ActiveSheet.Pictures. _ Insert (sPath & "\" & FileName) NewWS.Name = FileName Next Else MsgBox "There were no files found." End If End With End Sub --- HTH Jason Atlanta, GA -----Original Message----- I have several jpgs that have to be inserted into each separate worksheet. Is it possible to batch this along with naming the worksheet tabs the jpg name? Regards Sunny . |
#3
|
|||
|
|||
Jason,
That worked wonders! Thanks a bunch! Sunny |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple worksheets open on starting Excel. | Excel Discussion (Misc queries) | |||
How can I have excel search and add multiple cells to find a targe | Excel Discussion (Misc queries) | |||
Excel - printing multiple worksheets on one page | Excel Discussion (Misc queries) | |||
Excel should support multiple monitors better (like Word does) | Excel Worksheet Functions | |||
How can I combine multiple cells in Excel? | Excel Discussion (Misc queries) |