Folks...
I'm having trouble using the .GoTo method of an Excel object. Can someone advise me? I've tried several methods, and all receive the following error: "Error 1004: Method 'Goto' of object '_Application' failed."
Here are two of the attempts:
EXAMPLE 1:
Dim xl As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim strFile As String
Dim booXLOpen As Boolean
Dim intNameCounter As Integer
booXLOpen = True
Set xl = GetObject(, "Excel.application"
xl.Visible = False
'strFile has been assigned a value from a table
Set wb = GetObject(strFile)
wb.Application.Goto Reference:=wb.Names(intNameCounter)
------------------
EXAMPLE 2:
(This changes only the last line to the following
'retrieve top-left cell location from named range
'this is within a loop, based on intNameCounter
intColonPosition = InStr(wb.Names _
(intNameCounter).RefersToR1C1Local, ":"
strTopLeftCell = Mid(wb.Names _
(intNameCounter).RefersToR1C1Local, _
intBangPosition + 1, intColonPosition - _
(intBangPosition + 1))
wb.Application.Goto Reference:=strTopLeftCell
I'm having trouble using the .GoTo method of an Excel object. Can someone advise me? I've tried several methods, and all receive the following error: "Error 1004: Method 'Goto' of object '_Application' failed."
Here are two of the attempts:
EXAMPLE 1:
Dim xl As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim strFile As String
Dim booXLOpen As Boolean
Dim intNameCounter As Integer
booXLOpen = True
Set xl = GetObject(, "Excel.application"
xl.Visible = False
'strFile has been assigned a value from a table
Set wb = GetObject(strFile)
wb.Application.Goto Reference:=wb.Names(intNameCounter)
------------------
EXAMPLE 2:
(This changes only the last line to the following
'retrieve top-left cell location from named range
'this is within a loop, based on intNameCounter
intColonPosition = InStr(wb.Names _
(intNameCounter).RefersToR1C1Local, ":"
strTopLeftCell = Mid(wb.Names _
(intNameCounter).RefersToR1C1Local, _
intBangPosition + 1, intColonPosition - _
(intBangPosition + 1))
wb.Application.Goto Reference:=strTopLeftCell