Hallo liebe Gemeinde,
nachdem ich mich jetzt in Summe schon mehrere Stunden mit dem Problem rumschlage, suche ich hier ggf. Rat.
Wie im Titel beschrieben, handelt es sich um ein Exel / Autoit 'Issue'.
Was mache ich:
Script Function: New Backup procedure using Personal Backup software
- Progressbar starten
- Excel Object Attach, Run VB Macro, Save in Cloud + Local <----------- hier kommt dann der Fehler zumTragen aber nur in der exe Datei - im Script funzt alles
- Start PB Software
- Show Backup Log
Wie gesagt das Script wird fehlerfrei ausgeführt / die kompilierte Version nicht
Der Start des kompilierten Scripts erfolgt per Windows TaskScheduler durch einen Zeittrigger der die EXE Datei aufruft
Hier FM die auftauchen
Fehlermeldung 1:
Error attaching to 'Https://.....X1.xlsm'
@error = 1, @extended = -2147352570
Fehlermeldung 2:
Line 3419 (File .....cdePB_BkpNew.exe):
Error: Variable must be of type "Object".
mir fällt dazu leider nichte mehr ein - vllt wiee ja jemand weiter
Danke schon einmal im voraus
Hier das Script (anonymisiert)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=cde_PB_bkpNew.exe
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Excel.au3>
#include <MsgBoxConstants.au3>
#cs ----------------------------------------------------------------------------
PRIVAT SCRIPT / PRIVAT PURPOSES ONLY
AutoIt Version: 3.3.14.2
Author: Christoph Diener
Phone: +49 6196.76430-28
E-Mail: christoph.diener@gmx.de
WWW: http://christophdiener@jimdo.com
Created: cde 15-03-2016
Script Function: New Backup procedure using Personal Backup software
- Progressbar
- Excel Object Attach, Run VB Macro, Save in Cloud + Local
- Start PB Software
- Show Backup Log
#ce ----------------------------------------------------------------------------
;~ ProgressBar Start 2% / ProgressBar Steps = 20% (added 18.01.2013 'new progress bar' -cde-)
;~ Positioning the Progessbar in the lower right corner
$x = @DesktopWidth - 350
$y = @DesktopHeight - 200
ProgressOn("Daily Backup ... -cde-","Start ... ", "",$x, $y, 16)
$i = 2
ProgressSet($i,"...")
;~ Save Excel Workbook CDE_HaushaltsbuchNew.xlsm on SkyDrive & Local
Local $oWorkbook = "X1.xlsm"
Local $sWorkbook = "https://d.docs.live.net/xxxxxx/Dokumente/X1.xlsm"
Local $sWorkbook1 = "d:\xxxxxx\X1.xlsm"
$i = 20
ProgressSet($i,"1/5 - Cloud save ---> " & $oWorkbook)
Sleep(500)
;~ WinActivate("x1xlsm - Excel")
$oWorkbook = _Excel_BookAttach($oWorkbook, "filename")
If @error Then MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error attaching to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~ If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error attaching to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended, 2)
;~ MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example 2", "Search by 'filename':" & @CRLF & @CRLF & "Successfully attached to Workbook '" & $sWorkbook & "'." & @CRLF & @CRLF & "Value of cell A2: " & $oWorkbook.Activesheet.Range("A2").Value)
;~ Run VB Macro within Excel Application
$oWorkbook.Application.Run("X1.xlsm!cdeSetCommentar")
_Excel_BookSaveAs($oWorkbook, $sWorkbook,$xlOpenXMLWorkbookMacroEnabled, True)
_Excel_BookSaveAs($oWorkbook, $sWorkbook1,$xlOpenXMLWorkbookMacroEnabled, True)
If @error Then MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended, 2)
;~ ;~ If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended, 2)
;~ MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example 1", "Workbook successfully saved as '" & $sWorkbook & "'.")d:\Laptop\Daten\Tools\Back4Sured:\Laptop\Daten\Tools\Back4Sure
;~ Save Excel WorkboX2.xlsm"
Local $sWorkbook = "https://d.docs.live.net/xxxxxx/Dokumente/X2.xlsm"
Local $sWorkbook1 = "d:\xxxxxx\2.xlsm"
$i = 40
ProgressSet($i,"2/5 - Cloud save ---> " & $oWorkbook )
Sleep(500)
$oWorkbook = _Excel_BookAttach($oWorkbook, "filename")
If @error Then MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error attaching to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended, 2)
;~ If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error attaching to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~ MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example 2", "Search by 'filename':" & @CRLF & @CRLF & "Successfully attached to Workbook '" & $sWorkbook & "'." & @CRLF & @CRLF & "Value of cell A2: " & $oWorkbook.Activesheet.Range("A2").Value)
_Excel_BookSaveAs($oWorkbook, $sWorkbook,$xlOpenXMLWorkbookMacroEnabled, True)
_Excel_BookSaveAs($oWorkbook, $sWorkbook1,$xlOpenXMLWorkbookMacroEnabled, True)
If @error Then MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended, 2)
;~ If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Backup -cde-", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
;~ MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example 1", "Workbook successfully saved as '" & $sWorkbook & "'.")
$i = 60
ProgressSet($i,"3/5 - Copy personal setting files")
Sleep(500)
$i = 80
ProgressSet($i,"4/5 - Start PersonalBackup")
Sleep(500)
;~ Start Backup Software
ShellExecuteWait("d:\yyyyyy\PersonalBackup\PersBackup.exe", "d:\yyyyyy\PersonalBackup\cdeDaily.buj /force /hide /log:2")
ProgressSet(100, "5/5 - That's it - More informationen see 'Backup.Log'", " ")
Sleep(2000)
ProgressOff()
;~ Show Logfile
Run(@WindowsDir & "\notepad.exe" & " " & "d:\yyyyyy\PersonalBackup\Persbackup.log")
Sleep(1000)
Send("^{END}")
Exit
;~ MsgBox($MB_SYSTEMMODAL, "PersonalBackup -cde-", "Backup finished, please check Log", 2)
;~ KeepassSikSource = "d:\Laptop\Offline Files\10-InProcess\*.*x*" - passiert schon über pcloud sync
Alles anzeigen