Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

EXCEL VBA PROGRAM TO INSERT THE MAGMA RESULT PICTURE

Nidec SC WADO CO.,


LTD.

1.

INTRODUCTION

Please follow the following steps to insert the picture in easy way and no need to spend too much
time for picture alignment and editing in excel for magma result report.

STEP 1: - STANDARD THE EXCEL TEMPLETE




Set the Width size should be 21.88 should be 6 Columns

Set the Height size should be 32.25 should be 15 Rows

Select and click the Merge Cell

Page 1 of 5

EXCEL VBA PROGRAM TO INSERT THE MAGMA RESULT PICTURE


Nidec SC WADO CO.,
LTD.

STEP 2: - RUN THE VBA PROGRAM IN EXCEL




Enter Alt + F11, Microsoft Visual Basic Screen will open.

Double Click the Active Sheet (For example I will open Sheet 11 (Standard Format) in left
Side Corner

Program screen will open and Copy the Below VBA program and Past into the White
Screen.

Page 2 of 5

EXCEL VBA PROGRAM TO INSERT THE MAGMA RESULT PICTURE


Nidec SC WADO CO.,
LTD.

Sub InsertPictures()
Dim
Dim
Dim
Dim
Dim

Pict() As Variant
ImgFileFormat As String
PictCell As Range
lLoop As Long
sShape As Picture

ActiveSheet.Protect False, False, False, False, False


ImgFileFormat = "All Picture
Files(*.emf;*.wmf;*.jpg;*.jpeg;*.jfif;*.jpe;*.png;*.bpm;*.gif;*.gfa;*.emz;*.wmz;*.p
cz;*.tif;*.tiff;*.cgm;*.eps;*.pct;*.pict;*.wpg;*.pcd;*.pcx;*.cdr;*.fpx;*.mix),
*.bmp"
'Note you can load in any nearly file format
Pict = Application.GetOpenFilename(ImgFileFormat, MultiSelect:=True)
If Not IsArray(Pict) Then
Debug.Print "No files selected."
Exit Sub
End If
Set PictCell = Selection.Cells(1)
For lLoop = LBound(Pict) To UBound(Pict)
Set sShape = ActiveSheet.Pictures.Insert(Pict(lLoop))
With sShape
If .Height < 408.75 Then
PictCell.EntireRow.RowHeight = .Height
End If
'
If .Width < 254 Then
'
PictCell.EntireColumn.ColumnWidth = .Width
'
End If
.Top = PictCell.Top
.Left = PictCell.Left
End With
Set PictCell = PictCell.Offset(1)
Next lLoop
End Sub

Page 3 of 5

EXCEL VBA PROGRAM TO INSERT THE MAGMA RESULT PICTURE


Nidec SC WADO CO.,
LTD.

STEP 3: - RUN THE VBA PROGRAM




Click F5 to run the Microsoft Visual Program

Image selection screen will open and select the Folder location of Magma Result Location.

Select the image based on the % filling Ration and click Open.

Page 4 of 5

EXCEL VBA PROGRAM TO INSERT THE MAGMA RESULT PICTURE


Nidec SC WADO CO.,
LTD.

STEP 4: - IMAGE WILL PLACE INTO EXCEL SHEET

Page 5 of 5

You might also like