Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am assigning the Word office application to an Application variable called L_V_Scalar_Application_Generic which is obtained with the below function.

This worked perfectly in Word 2013 - see the first screen print of http://i.stack.imgur.com/9Empr.jpg[^]

After upgrading to Word 2016, almost all attributes of my variable are now just a question mark - see the second screen print of the link above.

The online documentation for Application seems to have changed between these versions of Office:

Office 2013: Application Interface (Microsoft.Office.Interop.Word)[^]

Office 2015: Application interface (Microsoft.Office.Interop.Word)[^]

I think that this is the cause of my problem, but I am not able to decipher exactly what the issue is or how to resolve it.

I posted this previously on the MSDN forum (Differing behaviour of VB.net's handling of .Application between Word 2013 and Word 2016[^]) but the forum moderator suggested that there is no solution to this issue. I am hoping that a member of the Code Project community will have a more helpful response...

Any help would be greatly appreciated!

Many thanks in advance,

Keith


VB
Public Shared Function G_F_Scalar_Application_GetReferenceToExistingOrNewIfThereIsNoExisting() As Application
			Dim L_V_Scalar_Application_Generic As Application
			Try
				L_V_Scalar_Application_Generic = DirectCast(
					System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"),
					Application
				)
			Catch L_V_Scalar_Exception_Generic As System.Exception
				L_V_Scalar_Application_Generic = DirectCast(
					Microsoft.VisualBasic.CreateObject("Word.Application"),
					Application
				)
				L_V_Scalar_Application_Generic.Visible = False
				L_V_Scalar_Application_Generic.DisplayAlerts = WdAlertLevel.wdAlertsNone
			End Try
			Return L_V_Scalar_Application_Generic
		End Function


What I have tried:

I have also asked on Stack Overflow a couple of days ago. There was no response from anyone.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900