How to move cursor in Excel

Discussion in 'AutoCAD' started by Adesu, Mar 30, 2005.

  1. Adesu

    Adesu Guest

    I just open and set column A from default to 25,now I want to move this
    cursor to column B,how to set it

    (setq xls "C:/YBI/Adesu/ext.xls")
    (setq xlsfile (getfiled "Open Excel File" xls "xls" 0))
    (setq exe "c:\\program files\\microsoft office\\office\\Excel.exe")
    (startapp (strcat "\"" exe "\"")(strcat "\"" xlsfile "\""))

    (setq eo (vlax-get-object "Excel.Application"))
    (setq wb (vlax-get-property eo 'WorkBooks))
    (setq as (vlax-get-property eo 'ActiveSheet))
    (setq ac (vlax-get-property eo 'ActiveCell))
    ; to find old set
    (setq old_cw (vlax-get-property ac 'ColumnWidth))
    (setq old_cw (vlax-variant-value old_cw))
    ; to new set
    (vlax-put-property ac 'ColumnWidth 25)
     
    Adesu, Mar 30, 2005
    #1
  2. Adesu

    Dann Guest

    (setq ac(vlax-get-property ac 'Next))
    (vlax-invoke-method ac 'Activate)
     
    Dann, Mar 31, 2005
    #2
  3. Adesu

    Dann Guest

    p.s. You don't need to activate it to enter info while in your program
    you can just get-next than put-value.
     
    Dann, Mar 31, 2005
    #3
  4. Adesu

    Adesu Guest

    Hi Dann,it's nice and I've got it,thanks a lot

    $ (vl-load-com)

    _$ (setq xls "C:/YBI/Adesu/ext.xls")
    (setq xlsfile (getfiled "Open Excel File" xls "xls" 0))
    (setq exe "c:\\program files\\microsoft office\\office\\Excel.exe")
    (startapp (strcat "\"" exe "\"")(strcat "\"" xlsfile "\""))
    "C:/YBI/Adesu/ext.xls"
    "C:\\YBI\\ADESU\\ext.xls"
    "c:\\program files\\microsoft office\\office\\Excel.exe"
    17679
    _$ (setq eo (vlax-get-object "Excel.Application"))
    (setq wb (vlax-get-property eo 'WorkBooks))
    (setq as (vlax-get-property eo 'ActiveSheet))
    (setq ac (vlax-get-property eo 'ActiveCell))
    #<VLA-OBJECT _Application 00afd90c>
    #<VLA-OBJECT Workbooks 00afc9ec>
    #<VLA-OBJECT _Worksheet 00afcc14>
    #<VLA-OBJECT Range 00afce5c>
    _$ (setq old_cw (vlax-get-property ac 'ColumnWidth))
    (setq old_cw (vlax-variant-value old_cw))
    #<variant 5 8.43>
    8.43
    _$ (vlax-put-property ac 'ColumnWidth 25)
    nil
    _$ (setq c2 (vlax-get-property ac 'Next))
    #<VLA-OBJECT Range 00afc494>
    _$ (vlax-dump-object c2)
    ; Range: nil
    ; Property values:
    ; AddIndent = 0
    ; Address (RO) = ...Indexed contents not shown...
    ; AddressLocal (RO) = ...Indexed contents not shown...
    ; Application (RO) = #<VLA-OBJECT _Application 00afd90c>
    ; Areas (RO) = #<VLA-OBJECT Areas 00afb9b0>
    ; Borders (RO) = #<VLA-OBJECT Borders 00afe588>
    ; Cells (RO) = #<VLA-OBJECT Range 00afe7c0>
    ; Characters (RO) = ...Indexed contents not shown...
    ; Column (RO) = 2
    ; Columns (RO) = #<VLA-OBJECT Range 00afe9f8>
    ; ColumnWidth = 8.43
    ; Comment (RO) = nil
    ; Count (RO) = 1
    ; Creator (RO) = 1480803660
    ; CurrentArray (RO) = Microsoft Excel: No cells were found.
    ; CurrentRegion (RO) = #<VLA-OBJECT Range 00afecbc>
    ; Dependents (RO) = Microsoft Excel: No cells were found.
    ; DirectDependents (RO) = Microsoft Excel: No cells were found.
    ; DirectPrecedents (RO) = Microsoft Excel: No cells were found.
    ; End (RO) = ...Indexed contents not shown...
    ; EntireColumn (RO) = #<VLA-OBJECT Range 00afeef4>
    ; EntireRow (RO) = #<VLA-OBJECT Range 00aff12c>
    ; Font (RO) = #<VLA-OBJECT Font 00aff364>
    ; FormatConditions (RO) = #<VLA-OBJECT FormatConditions 00aff59c>
    ; Formula = ""
    ; FormulaArray = ""
    ; FormulaHidden = 0
    ; FormulaLabel = -4142
    ; FormulaLocal = ""
    ; FormulaR1C1 = ""
    ; FormulaR1C1Local = ""
    ; HasArray (RO) = 0
    ; HasFormula (RO) = 0
    ; Height (RO) = 12.75
    ; Hidden = Microsoft Excel: Unable to get the Hidden property of the Range
    class
    ; HorizontalAlignment = 1
    ; Hyperlinks (RO) = #<VLA-OBJECT Hyperlinks 00ae9328>
    ; ID = ""
    ; IndentLevel = 0
    ; Interior (RO) = #<VLA-OBJECT Interior 00af6ebc>
    ; Item = ...Indexed contents not shown...
    ; Left (RO) = 135.0
    ; ListHeaderRows (RO) = 0
    ; LocationInTable (RO) = Microsoft Excel: Unable to get the
    LocationInTable property of the Range class
    ; Locked = -1
    ; MergeArea (RO) = #<VLA-OBJECT Range 00af7124>
    ; MergeCells = 0
    ; Name = Exception occurred
    ; Next (RO) = #<VLA-OBJECT Range 00af734c>
    ; NumberFormat = "General"
    ; NumberFormatLocal = "General"
    ; Offset (RO) = ...Indexed contents not shown...
    ; Orientation = -4128
    ; OutlineLevel = Microsoft Excel: Unable to get the OutlineLevel property
    of the Range class
    ; PageBreak = Microsoft Excel: Unable to get the PageBreak property of the
    Range class
    ; Parent (RO) = #<VLA-OBJECT _Worksheet 00afcc14>
    ; Phonetic (RO) = #<VLA-OBJECT Phonetic 00af7584>
    ; Phonetics (RO) = nil
    ; PivotField (RO) = Microsoft Excel: Unable to get the PivotField property
    of the Range class
    ; PivotItem (RO) = Microsoft Excel: Unable to get the PivotItem property
    of the Range class
    ; PivotTable (RO) = Microsoft Excel: Unable to get the PivotTable property
    of the Range class
    ; Precedents (RO) = Microsoft Excel: No cells were found.
    ; PrefixCharacter (RO) = ""
    ; Previous (RO) = #<VLA-OBJECT Range 00af77bc>
    ; QueryTable (RO) = Exception occurred
    ; Range (RO) = ...Indexed contents not shown...
    ; ReadingOrder = -5003
    ; Resize (RO) = ...Indexed contents not shown...
    ; Row (RO) = 1
    ; RowHeight = 12.75
    ; Rows (RO) = #<VLA-OBJECT Range 00af79f4>
    ; ShowDetail = Microsoft Excel: Unable to get the ShowDetail property of
    the Range class
    ; ShrinkToFit = 0
    ; SoundNote (RO) = #<VLA-OBJECT SoundNote 00af7c2c>
    ; Style = #<VLA-OBJECT Style 00aff9d4>
    ; Summary (RO) = Microsoft Excel: Unable to get the Summary property of
    the Range class
    ; Text (RO) = ""
    ; Top (RO) = 0.0
    ; UseStandardHeight = -1
    ; UseStandardWidth = -1
    ; Validation (RO) = #<VLA-OBJECT Validation 00affbfc>
    ; Value = nil
    ; Value2 = nil
    ; VerticalAlignment = -4107
    ; Width (RO) = 48.0
    ; Worksheet (RO) = #<VLA-OBJECT _Worksheet 00afcc14>
    ; WrapText = 0
    ; _Default = ...Indexed contents not shown...
    ; _NewEnum (RO) = #<IUnknown 00affd28>
    T
    _$ (vlax-invoke-method c2 'Activate)
    #<variant 11 -1>
    _$ (setq old_cw2 (vlax-get-property c2 'ColumnWidth))
    (setq old_cw2 (vlax-variant-value old_cw2))
    #<variant 5 8.43>
    8.43
    _$ (vlax-put-property c2 'ColumnWidth 25)
    nil
    _$
     
    Adesu, Apr 4, 2005
    #4
  5. Adesu

    Adesu Guest

    Hi Dann,where you found word "Next"?,but for Activate I 've got it
     
    Adesu, Apr 4, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.