Hi Guys,
I want to do the following:
-> Firstly import multiple images from the location where my workbook is based. I want that to be automated coz the images will always be in the workbook location.
-> Secondly I need the images to be sorted one after the other like 2 images per 20 lines. FYI the name of the images will change at all times.
-> Thirdly I need to label the images like mentioning what it is.
-> Finally once all this is done I need all the images and contents to be aligned in the center.
I have some code which does not work properly->
Sub Macro2()
'
' Macro2 Macro
'
'
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Sheet1").Select
Range("C99").Select
Dim lngCount As Long
' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.Filters.Add "Pic Files", "*.jpg; *.png", 1
.AllowMultiSelect = True
.Show
' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
ActiveSheet.Pictures.Insert (.SelectedItems(lngCount))
Next lngCount
End With
ActiveWindow.SmallScroll Down:=6
ActiveSheet.Shapes.Range(Array("Picture 62")).Select
ActiveWindow.SmallScroll Down:=-27
Selection.ShapeRange.IncrementLeft 518.25
Selection.ShapeRange.IncrementTop -330
ActiveSheet.Shapes.Range(Array("Picture 61")).Select
Selection.ShapeRange.IncrementLeft -13.5
Selection.ShapeRange.IncrementTop -325.5
ActiveWindow.SmallScroll Down:=-42
Selection.ShapeRange.IncrementLeft -48.75
Selection.ShapeRange.IncrementTop -593.25
ActiveSheet.Shapes.Range(Array("Picture 62")).Select
Selection.ShapeRange.IncrementLeft -104.25
Selection.ShapeRange.IncrementTop -579
ActiveWindow.SmallScroll Down:=-36
ActiveSheet.Shapes.Range(Array("Picture 61")).Select
Selection.ShapeRange.IncrementLeft -33.75
Selection.ShapeRange.IncrementTop -551.25
ActiveSheet.Shapes.Range(Array("Picture 62")).Select
Selection.ShapeRange.IncrementLeft -90.75
Selection.ShapeRange.IncrementTop -554.25
ActiveSheet.Shapes.Range(Array("Picture 61")).Select
ActiveSheet.Shapes.Range(Array("Picture 62")).Select
Selection.ShapeRange.IncrementLeft 260.25
Selection.ShapeRange.IncrementTop -2.25
Selection.ShapeRange.IncrementLeft -73.5
Selection.ShapeRange.IncrementTop 1.5
ActiveSheet.Shapes.Range(Array("Picture 61")).Select
Selection.ShapeRange.IncrementLeft 129.75
Selection.ShapeRange.IncrementTop 1.5
Range("M26").Select
ActiveSheet.Shapes.Range(Array("Picture 62")).Select
Range("M27").Select
ActiveWindow.SmallScroll Down:=75
'''and so on....its a long code...just did it by recording the macro...but not working....
End Sub
There are 19 images in total. And the name of the folder inside the workbook.path location is "MetaboAnalyst Multivariate Analysis Output Files". It will always be the same. Also I am attaching the images for the betterment of the code. They are in .png format. Please find the attachment.
http://www.mediafire.com/?iul9ff2tky4ri9p
Thanks in advance guys.
Cheers
plasma33
Bookmarks