Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze games gaming hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Opening Word from code

Reply  
Thread Tools
WelshMike's Avatar
Junior Member with 5 posts.
 
Join Date: Jan 2010
Experience: Intermediate
29-Jan-2010, 02:30 PM #1
Opening Word from code
Hi Guys,
I posted this earlier to another section but it may be better suited to here.
Without going into too many details at this stage we have a web application that has an object embedded into one of the pages. This object has been built using VB.NET and basically it talks to a 3rd party application to get some data into a datagrid. This is not a problem. The user selects an entry from the grid and the application opens Word and triggers an addin (written in VB.NET) which then goes off and opens a specific Word document. The system is a bit more complicated than that but the point is all this works really well. The problem is that sometimes (well too often really) a user will make the selection and the document will open but Word has no menus or toolbars visible and there appears to be no way of getting them to show as there are no menus whatsoever to use. It is like the document is being shown in a picture window. The only way to resolve this situation is for the user to shut down word and try again.
Unfortunately it may take several goes until it works properly. The question is, does anybody know why this is happening and how do I stop it happening.
n00bSauce's Avatar
Computer Specs
Junior Member with 24 posts.
 
Join Date: Dec 2009
Location: North Carolina, USA
Experience: Telephony Warrior
29-Jan-2010, 06:45 PM #2
Mike,

Does the program actually launch a full-blown copy of word (like you get the splash screen, program, and all) or is it just loading an instance of the .NET "Word" object in your web application (so that you are using Word to display the content but it is all housed within your webapp's scope)?

I guess what I'm really asking is if you are launching a new Window just for Word or if this is all displayed as a control on your Web app in the existing window.

- Chris
WelshMike's Avatar
Junior Member with 5 posts.
 
Join Date: Jan 2010
Experience: Intermediate
30-Jan-2010, 06:21 AM #3
Hi,
It launches Word as a new application in it's own right. Obviously it is created as an object from the instantiating object but it is not opened as a window within the master object. As I said most of the time it works correctly but sometimes it opens like a viewer.

Mike
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
30-Jan-2010, 08:42 AM #4
Which code are you using to launch Microsoft Word ?
WelshMike's Avatar
Junior Member with 5 posts.
 
Join Date: Jan 2010
Experience: Intermediate
02-Feb-2010, 07:09 AM #5
Sorry for the delay in reply but I have been tied up on another project.

m_DocumentViewer =
CType(CreateObject("Word.Application"), Microsoft.Office.Interop.Word.Application)

m_DocumentViewer is declared as

PrivateWithEvents m_DocumentViewer As Microsoft.Office.Interop.Word.Application = Nothing

There is code previous to creating the instance of m_DocumentViewer that finds any process called "Winword" and kills it so that we don't latch onto any existing Word instance.

Once the Word instance has been created a document is opened and then a control on a custom addin command bar is executed to display the menu controls available to the user.

I have just spotted the following line
m_DocumentViewer.WindowState = WdWindowState.wdWindowStateMaximize

I wonder if this is the problem and maybe it should be after executing the command bar control?

Thanks for you help
Regards, Mike
WelshMike's Avatar
Junior Member with 5 posts.
 
Join Date: Jan 2010
Experience: Intermediate
08-Feb-2010, 08:08 AM #6
Any more thoughts anyone?

Regards
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:14 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.