Jump to content

LazyVasily

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

LazyVasily's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. water, Actually, I've always run scripts from the console. I just started compiling 64. Shows all the same error message. "Error attaching to the workbook! @error=1, extended = -2147352570"
  2. water, Excel 2013x64 and Excel2007 Autoit 3.3.14.0 Again specify. File 1.xls-not started with a click. And at the time of running the script file 1.xls is ALREADY open. The script should find the window-not by the file path, but by the name "Title". 1.xls
  3. TheSaint, Did everything you told me to do. #include <Excel.au3> #include <MsgBoxConstants.au3> Local $sWorkBook = "1.xls" Local $oExcel = _Excel_Open() If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error creating Excel object! @error = " & @error & ", @extended = " & @extended) Local $oWorkBook = _Excel_BookAttach($sWorkbook, "Title") If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error attaching to the workbook! @error = " & @error & ", @extended = " & @extended) $oWorkBook.ActiveSheet.Shapes.Range("Oval 1").Delete If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error deleting shape! @error = " & @error & ", @extended = " & @extended) This script does not work. Displays a window with the error: "Error attaching to the workbook! @error=1, extended = -2147352570"
  4. JoHanatCent, Your script does not work. The script opens an additional copy of file 1.xls (read-only). In this copy - it removes the shape "Oval 1". The script then stops running. As a result - I have one open file 1.xls with two shapes, and one open file 1.xls (read-only) with one shape. No need to open file 1.xls because it's already open. You used the "filename" parameter again. I asked about using $sMode "Title". (https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_BookAttach.htm )
  5. water, This script still can't find window "1.xls". Shows the error "Error attaching to the workbook". Why do you write about "filename" ? I asked about the "title".
  6. water, I'm using your script. #include <Excel.au3> #include <MsgBoxConstants.au3> Local $sWorkBook = "1.xls" Local $oExcel = _Excel_Open() If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error creating Excel object! @error = " & @error & ", @extended = " & @extended) Local $oWorkBook = _Excel_BookAttach($sWorkbook, "title") If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error attaching to the workbook! @error = " & @error & ", @extended = " & @extended) $oWorkBook.ActiveSheet.Shapes.Range("Oval 1").Delete If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error deleting shape! @error = " & @error & ", @extended = " & @extended) The script still can't find the window "1.xls". Shows the error "Error attaching to the workbook".
  7. water, I understand. I made changes. The script still can't find the window "1.xls". #include <Excel.au3> #include <MsgBoxConstants.au3> ;Opt('WinTitleMatchMode', -2) Local $sWorkBook = "1.xls" $sExcel = _Excel_Open() If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error creating Excel object! @error = " & @error & ", @extended = " & @extended) $sWorkBook = _Excel_BookAttach($sWorkbook, "title") If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error attaching to the workbook! @error = " & @error & ", @extended = " & @extended) $sWorkBook.ActiveSheet.Shapes.Range("Oval 1").Delete If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error deleting shape! @error = " & @error & ", @extended = " & @extended) Shows the error "Error attaching to the workbook".
  8. water, Independently created a script similar to the example in the Help. The script does not work. Shows the error "Error attaching to the workbook". #include <Excel.au3> #include <MsgBoxConstants.au3> Opt('WinTitleMatchMode', -2) $oExcel = _Excel_Open() $sTitle = "1.xls" If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error creating Excel object! @error = " & @error & ", @extended = " & @extended) $oWorkBook = _Excel_BookAttach($sTitle) If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error attaching to the workbook! @error = " & @error & ", @extended = " & @extended) $oWorkBook.ActiveSheet.Shapes.Range("Oval 1").Delete If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error deleting shape! @error = " & @error & ", @extended = " & @extended) #include <Excel.au3> #include <MsgBoxConstants.au3> ;Opt('WinTitleMatchMode', -2) Local $oWorkBook = "1.xls" $oExcel = _Excel_Open() If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error creating Excel object! @error = " & @error & ", @extended = " & @extended) $oWorkBook = _Excel_BookAttach($sWorkbook, "title") If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error attaching to the workbook! @error = " & @error & ", @extended = " & @extended) $oWorkBook.ActiveSheet.Shapes.Range("Oval 1").Delete If @error Then Exit Msgbox($MB_ICONERROR, "Error", "Error deleting shape! @error = " & @error & ", @extended = " & @extended) What have I done wrong ? How to change this script so that it finds the right window 1.xls by Title ?
  9. water, But the help is missing an example for "$sMode Title" : https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_BookAttach.htm
  10. water, Advise - as replace "$Mode FileName" on "$sMode Title" in your script (Title of the Excel window) ? In Help no found example for "$sMode Title" (https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_BookAttach.htm)
  11. water, You don't quite understand what I'm asking. Your script works. But it works only in one case. It only works if the file " 1.xls" - will be opened by clicking on the file. If you open the file 1.xls in another way, the script does not work. After all, the file can be opened by hyperlink or simply through the Excel menu. The file thus opened is " 1.xls " - the script does not recognize and displays an error window. I asked - how to remove the shape "Oval 1" if the file 1.xls was opened not by clicking on this file, but in another way ? The file can be opened via the Excel menu (and now AutoIt-script does not see it).
  12. water, File 1.xls is open at the time of running your script. An error window appears :
  13. AutoBert, This code doesn't work. #include <Excel.au3> $oWorkBook = _Excel_BookAttach(@ScriptDir & "\1.xls") $oExcel = _Excel_Open() $oWorkBook.ActiveSheet.Shapes.Range(("Oval 1")).Delete It works only in rare exceptions - if you close all Excel files and run the desired file 1.xls by clicking on it. In other cases, this code does not work. Gives an error "Variable must be of type Object". How to delete the shape "Oval 1"regardless of how the file 1.xls was open-click or through the Excel program ?
×
×
  • Create New...