D
Doug Robbins - Word MVP
Automating Excel from Word (2007), I have a variable var3 that contains a
reference of the form SheetName!R#C#:R#C#
Using, and without Activating Excel
xlApp.GoTo Reference:=var3
Set datarange = xlApp.Selection
datarange.Copy
I can copy the required information to the clipboard so that it can be
pasted into Word.
If however, I make Excel visible, the nearest that I can come to actually
selecting the range is to use
xlApp.Visible = True
var2 = Left(var3, InStr(var3, "!") - 1)
xlApp.Worksheets(var2).Activate
xlApp.GoTo Reference:=var3
and adding
Set datarange = xlApp.Selection
datarange.Copy
to the above, does not necessarily cause the required range of cells to be
copied (not that I really need to copy them in this situation,)
Activating the Worksheet was necessary to get the Worksheet containing the
range to be made the active Worksheet.
When Excel is visible, is there a way to get it to actually select a
specific range of cells?
Thanks for any assistance.
reference of the form SheetName!R#C#:R#C#
Using, and without Activating Excel
xlApp.GoTo Reference:=var3
Set datarange = xlApp.Selection
datarange.Copy
I can copy the required information to the clipboard so that it can be
pasted into Word.
If however, I make Excel visible, the nearest that I can come to actually
selecting the range is to use
xlApp.Visible = True
var2 = Left(var3, InStr(var3, "!") - 1)
xlApp.Worksheets(var2).Activate
xlApp.GoTo Reference:=var3
and adding
Set datarange = xlApp.Selection
datarange.Copy
to the above, does not necessarily cause the required range of cells to be
copied (not that I really need to copy them in this situation,)
Activating the Worksheet was necessary to get the Worksheet containing the
range to be made the active Worksheet.
When Excel is visible, is there a way to get it to actually select a
specific range of cells?
Thanks for any assistance.