Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run excel command from VBA (reflection)

Status
Not open for further replies.

Mrslow

IS-IT--Management
Jan 20, 2006
1
US
I'm using an application called Reflection. Programming within Reflection can be done using VBA.
In my code I open an excel workbook after which I want to run a find command, i know how to select a cell but not how to run a command like find? it it possible at all and how ??

Code:
'CHECK TO SEE OF EXCEL IS ALREADY OPENED
    On Error Resume Next 'statement needed in order for aplication not to start in debug mode!
    Set ExcelApp = GetObject(, "Excel.Application")
    If Err Then
        Set ExcelApp = CreateObject("Excel.Application")
    End If
    Err.Number = 0
    
    Set ExcelToOpen = ExcelApp.Workbooks.Open(ExcelPath & ExcelFile)
    ExcelApp.Visible = True
    Set ExcelApp = Nothing

    ExcelToOpen.Sheets("Sheet1").Select
[i]
    With ExcelToOpen.sheet1.Range("a1:a65000")
        Set c = .Find("APLU", lookin:=xlvalues)
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                c.Value = 5
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> firstAddress
        End If
    End With
[i]
the above with stamenent doesn't run
a command like
Code:
ExcelToOpen.Sheets("Sheet2").Select"
does work

Appreciate any tips....
 
Hi,
Code:
    [s]Set ExcelApp = Nothing

    ExcelToOpen.Sheets("Sheet1").Select[/s]

    With ExcelToOpen.Sheets("Sheet1").Range("a1:a65000")
        Set c = .Find("APLU", lookin:=xlvalues)
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                c.Value = 5
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> firstAddress
        End If
    End With
'...
    Set ExcelApp = Nothing


Skip,

[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top