ahk copy multible selections to another sheet

Get help with using AutoHotkey and its commands and hotkeys
tonn0297
Posts: 1
Joined: 18 Jan 2019, 01:20

ahk copy multible selections to another sheet

18 Jan 2019, 02:42

hello i have a Little trouble and i hoped you could help me.
i have this excel sheet that i have 12 different "templates" in and i want the ability to chose which ones to send over to another excel sheet. like a report.
Ive got the copy to work with one thing but it don't copy more.
Ive attached a pic of the GUI and code.


Code: Select all

Gui, Add, Edit, x85 y7 w190 h30 , Sti
Gui, Add, Text, x0 y7 w85 h20 , Template
Gui, Add, Button, x160 y460 w100 h30 gGenerer, generer
Gui, Add, CheckBox, x26 y40 w100 h50 , Logo
Gui, Add, CheckBox, x26 y80  w200 h50 vPumpe1, Pumpe 1
Gui, Add, CheckBox, x26 y120 w200 h50 vPumpe2, Pumpe 2
Gui, Add, CheckBox, x26 y160 w200 h50 , Pumpe 3
Gui, Add, CheckBox, x26 y200 w200 h50 , Service thermo
Gui, Add, CheckBox, x26 y240 w200 h50 , Service kontaktor
Gui, Add, CheckBox, x26 y280 w200 h50 , service rep afb
Gui, Add, CheckBox, x26 y320 w200 h50 , service vlt
Gui, Add, CheckBox, x26 y360 w200 h50 , parameter 1
Gui, Add, CheckBox, x26 y400 w200 h50 , parameter 2
Gui, Add, CheckBox, x26 y440 w200 h50 , Underskrift

Gui, Show, x131 y91 h500 w277, Excel Gui

Return

GuiClose:
x2.quit
x1.quit
ExitApp

 Generer:
 Gui, Submit ;opdater checkboxes
 
 ;start template excel
 xl := ComObjCreate("Excel.Application")
 xl.Visible := true
 wbPath1 := "C:\Users\BAa\Desktop\test.xlsx"
 wb1 := xl.Workbooks.open(wbPath1)
 Enabled := ComObjError(Enable)
 if ComObjError = true
 {
  x1.quit
 }
 ;start raport excel
 
 x2 := ComObjCreate("Excel.Application")
 x2.Visible := true
 wbPath2 := ""
 wb2 := x2.Workbooks.Add(wbPath2)
 column := "A"
 Enabled := ComObjError(Enable)
  if ComObjError = true
 {
  x2.quit
 }
 
 ;hvilke ting skal der med?
 
 If (Pumpe1 = true) 
{
 begin := xl.Columns(column).Find("m001s001_st")

 end :=   xl.Columns(column).Find("m001s001_so", begin)
  xl.Range(begin.row+1 ":" end.row-1).Copy
 x2.ActiveSheet.Paste
 
 xl := window.activesheet

 
 return
}

If (Pumpe2 = true) 
{ 
 begin := xl.Columns(column).Find("m002s001_st")

 end :=   xl.Columns(column).Find("m002s001_so", begin)
  xl.Range(begin.row+1 ":" end.row-1).Copy
 x2.ActiveSheet.Paste
 
return
}
 

any help is much appreciated.
Attachments
ahk.png
ahk.png (119.25 KiB) Viewed 301 times

Return to “Ask For Help”

Who is online

Users browsing this forum: Chunjee, Fefint, just me, MARCAN, Odlanir and 229 guests