View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] info@ecsystems.nl is offline
external usenet poster
 
Posts: 2
Default vba code to send a filename to word without starting a new session

On Tuesday, August 30, 2016 at 4:55:03 AM UTC+2, GS wrote:
Generally speaking, it's not considered 'best practice' to hijack a
running instance of any app that supports multiple instances. That more


It should be optional like some generic viewers are, you want a quick view and not be wasting time closing additional instances.

If you manually start Word specifically for your Excel project's use
you can establish a link to it...

Dim appWD As Object

'Grab running instance
Set appWD = GetObject("Word.Application")


Tnx, this works but is very slow to start.

I've reverted to using 'shell' and a portable generic viewer who has that single instance option so the viewer can stay in a fixed position on the second monitor.

Set b = ActiveSheet.Buttons(Application.Caller)
With b.TopLeftCell
cs = .Column
rs = .Row
End With
Set Rng = ActiveSheet.Range(CStr(cs) + CStr(rs))
TaskID = Shell("C:\Program Files\gviewer\viewer.exe" + " " + Rng, vbHide)

Fast, no office starttime overhead or none-requested conversions, you click and its immediately on the screen.