cell_val := 1
OR
cell_val = 1
So I could have xlRng := xlApp.Range("A%cell_val%") as xlRng := xlApp.Range("A1") . But thousands of errors occured while I tried... I just wanted to add new image from A17 cell, next one at A33, so image every 16 rows. Similar with text. First text at A15, next text A31. Now I wonder if IS IT EVEN POSSIBLE to manipulate such excel methods/variables etc? And what I tried is impossible? Code below is working fine, adds image from given folder and their filenames under... but it just adds one picture ON another (stacking them) so its not finished.
Code: Select all
#Include XL.ahk
FileSelectFolder, WhichFolder
XL := ComObjCreate("Excel.Application")
XL.WorkBooks.Add
XL.Visible := true
WinMaximize, ahk_exe excel.exe
Sheet := XL.ActiveSheet
ComObjConnect(Sheet, Worksheet_Events)
Sheet.Columns("A").ColumnWidth := 37
Loop Files, %WhichFolder%\*.*, R
{
FilePath := A_LoopFileFullPath
SplitPath, A_LoopFileFullPath, namefile
xlApp := ComObjActive("Excel.Application")
xlRng := xlApp.Range("A1") ;paste first image at A1
xlApp.ScreenUpdating := false
xlShape := xlApp.ActiveSheet.Shapes.AddPicture(FilePath, false, true, xlRng.Left, xlRng.Top, -1, -1)
xlShape.LockAspectRatio := true
xlShape.Width := 200
xlApp.ScreenUpdating := true
Xl.Range("A15").Value := namefile ;add file-name text under image
}