Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I got pretty far with my vba project but got stuck now. What I have so far: I have 2 monitors, on the left an excel sheet with filenames and on the right Word running. When I click on a cell with a filename a Word session is started with the file opened. The issue: Each cell click results in a new Word session being started. What Im looking for: Vba code to tell a running Word session to display the file selected in question (and not open a new Word session) The point being is that Word can be sized to best fit the right monitor and stay that way while different files are selected from excel and viewed in Word. Probably some sort of DDE call needed but cant figure out how. In the near future Id like this to work for powerpoint, IE and pdf-readers as well. Windows 7 and office 2010. Maybe there is a generic document viewer which has the option €śallow only one instance€ť which would solve the issue as well. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I got pretty far with my vba project but got stuck now. What I have so far: I have 2 monitors, on the left an excel sheet with filenames and on the right Word running. When I click on a cell with a filename a Word session is started with the file opened. The issue: Each cell click results in a new Word session being started. What Im looking for: Vba code to tell a running Word session to display the file selected in question (and not open a new Word session) The point being is that Word can be sized to best fit the right monitor and stay that way while different files are selected from excel and viewed in Word. Probably some sort of DDE call needed but cant figure out how. In the near future Id like this to work for powerpoint, IE and pdf-readers as well. Windows 7 and office 2010. Maybe there is a generic document viewer which has the option €śallow only one instance€ť which would solve the issue as well. Word was designed that way. It always will open another doc in a new 'instance'. If you only need 1 doc open at a time you could close each doc before opening another. This would require you start an instance of Word from Excel, then use that 1 instance for all files. Optionally, you could start an instance and set it up as desired, then grab a fully qualified ref to it. Generally speaking, it's not considered 'best practice' to hijack a running instance of any app that supports multiple instances. That more or less means if your Excel (or any other) VBA project needs to use another app then you should create your own instance of that app... Dim appWD As Object Set appWD = CreateObject("Word.Application") ...and don't forget to release its mem space when done with it! Set appWD = Nothing 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") 'If not running, start your own instance If appWD Is Nothing Then Set appWD = CreateObject("Word.Application") With appWD 'do stuff... End With 'appWD Set appWD = Nothing FWIW I've been authoring userguides, tech/instruction manuals, product user manuals, statistical reports, slideshows, and ebooks in Excel since v2000. I don't use Word much because I haven't found anything it can do that can't be done in Excel equally as well or better. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. Nice! It still leaves your project with a dependency, making distribution more complex than it needs be. IMO, a NewWindow in Excel would suffice. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with .send from microsoft example for vba send mail from excel code | Excel Programming | |||
CreateObject("Word.Application") fails though Word session starts | Excel Programming | |||
Startup and template locations in Citrix TS session and local session | Setting up and Configuration of Excel | |||
Using Excel to start a merge session in Word | Excel Programming | |||
My send to in excel/word does not offer send as attachment | Excel Discussion (Misc queries) |