Thanks for your input and fast response.
Tried using this, but still getting "The COM object might not be a valid one" on pretty much everything.
Code:
#Include Cohelper.ahk
#include COM.ahk
run N:\06 lejlighedstjek\Program\autofinish.exe,,,autopid
Gui, Add, Text, x36 y30 w360 h30 , Print 10 lejligheder af gangen
Gui, Add, Edit, x36 y70 w180 h20 v1, Fisk
Gui, Add, Edit, x36 y100 w180 h20 v2,
Gui, Add, Edit, x36 y130 w180 h20 v3,
Gui, Add, Edit, x36 y160 w180 h20 v4,
Gui, Add, Edit, x36 y190 w180 h20 v5,
Gui, Add, Edit, x36 y220 w180 h20 v6,
Gui, Add, Edit, x36 y250 w180 h20 v7,
Gui, Add, Edit, x36 y280 w180 h20 v8,
Gui, Add, Edit, x36 y310 w180 h20 v9,
Gui, Add, Edit, x36 y340 w180 h20 v10,
Gui, Add, Button, x36 y380 w180 h50 Gprint, PRINT
Gui, Show, x350 y228 h467 w252, MegaPrint
return
Print:
Gui, Submit , NoHide
if 1 =
{
msgbox Intet at printe.
}
else
{
Process, Close, %autopid%
pxl := ActiveXObject("Excel.Application")
objExcel:=COM_Invoke(pxl,"Open","P:\test.xls")
COM_Invoke(sheetArk3:=COM_Invoke(objExcel, "Sheets", "Ark3"), "Select")
COM_Invoke(SheetReference:=COM_Invoke(activeWorkbo0k:=COM_Invoke(objExcel, "ActiveWindow"), "SelectedSheets"), "PrintOut")
COM_Release(SheetReference)
COM_Release(activeWorkbo0k)
COM_Release(sheetArk3)
COM_Release(objExcel)
COM_Invoke(pxl,"Quit")
msgbox printer
}
return