Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default 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   Report Post  
Jason Morin
 
Posts: n/a
Default

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   Report Post  
 
Posts: n/a
Default

Jason,

That worked wonders! Thanks a bunch!

Sunny

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple worksheets open on starting Excel. Jerry Excel Discussion (Misc queries) 3 April 13th 05 06:45 PM
How can I have excel search and add multiple cells to find a targe Blakepro Excel Discussion (Misc queries) 1 April 1st 05 02:37 AM
Excel - printing multiple worksheets on one page BGA Excel Discussion (Misc queries) 1 February 18th 05 03:05 PM
Excel should support multiple monitors better (like Word does) CoffeeAdict Excel Worksheet Functions 5 February 8th 05 03:04 AM
How can I combine multiple cells in Excel? jallbright24 Excel Discussion (Misc queries) 1 November 29th 04 05:54 PM


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"