|
-
Oct 19th, 2009, 11:50 PM
#1
Thread Starter
Lively Member
[RESOLVED] word application declaration error
Hi im working on an application which will generate a word doc. Now i have moved to some other system. if i opened my vb project from the new machine its showing the word application is not declared. i have add the refference. but no use:-(
Help me !!
Thanks in advance
-
Oct 20th, 2009, 12:36 AM
#2
Re: word application declaration error
Please mark you thread resolved using the Thread Tools as shown
-
Oct 20th, 2009, 01:20 AM
#3
Re: word application declaration error
Does this new system contain the same version of Word? which version was on the original system and on this new system?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 20th, 2009, 01:25 AM
#4
Re: word application declaration error
Ramesh, Rob has a valid question when he is asking which version are you using? Show the code where you are interacting/declaring with Word. I suspect that you must be using Early binding... You need to use Late Binding.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 20th, 2009, 01:33 AM
#5
Thread Starter
Lively Member
Re: word application declaration error
Yes. But Both the system having MS word2007. But the application will generate and save it in word2003 format.
-
Oct 20th, 2009, 01:41 AM
#6
Re: word application declaration error
Show the code where you are interacting/declaring with Word... Also the code where you are trying to save it as 2003 format... What is the FileFormat:xx number that you are using...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 20th, 2009, 01:42 AM
#7
Thread Starter
Lively Member
Re: word application declaration error
Imports Microsoft
Imports Word = Microsoft.Office.Interop.Word
Imports Microsoft.Win32
Imports System.Runtime.InteropServices
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Public Class MainWindow
'--- Windows API declarations
'Private Const WM_HOTKEY As Integer = &H312
Private Const MOD_ALT As Integer = &H1
Private Const MOD_CONTROL As Integer = &H2
Private Const MOD_SHIFT As Integer = &H4
Public Shared SysTray As New NotifyIcon()
Private Declare Function RegisterHotKey Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal id As Integer, ByVal fsModifier As Integer, ByVal vk As Integer) As Integer
Private Declare Function UnregisterHotKey Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal id As Integer) As Boolean
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As IntPtr) As Boolean
' New Code
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Short) As Short
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As Short
Dim hotkeyID As Short
Public WordApp As Word.Application
Public doc As Word.Document
Public FrstFlag, TxtFlag As Boolean
Dim LogLib, LogFile As String
Dim Zero_Str As String
Dim CurIndex_Int As Integer
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim Rng As Word.Range
'UnregisterHotKey(Me.Handle, 0)
UnregisterGlobalHotKey()
Try
If Trim(UCase(Set_Button.Text)) = "RE&SET" Then
'If TxtFlag Then
Rng = doc.Range
Rng.Collapse(Word.WdCollapseDirection.wdCollapseStart)
Rng.Delete()
TxtFlag = False
'End If
doc.SelectAllEditableRanges()
WordApp.Selection.ShapeRange.WrapFormat.Type = Word.WdWrapType.wdWrapSquare
doc.Save()
doc.Close()
FrstFlag = False
End If
Catch ex As NullReferenceException
End Try
-
Oct 20th, 2009, 01:43 AM
#8
Thread Starter
Lively Member
Re: word application declaration error
vb Code:
Imports Microsoft
Imports Word = Microsoft.Office.Interop.Word
Imports Microsoft.Win32
Imports System.Runtime.InteropServices
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Public Class MainWindow
'--- Windows API declarations
'Private Const WM_HOTKEY As Integer = &H312
Private Const MOD_ALT As Integer = &H1
Private Const MOD_CONTROL As Integer = &H2
Private Const MOD_SHIFT As Integer = &H4
Public Shared SysTray As New NotifyIcon()
Private Declare Function RegisterHotKey Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal id As Integer, ByVal fsModifier As Integer, ByVal vk As Integer) As Integer
Private Declare Function UnregisterHotKey Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal id As Integer) As Boolean
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As IntPtr) As Boolean
' New Code
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Short) As Short
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As Short
Dim hotkeyID As Short
Public WordApp As Word.Application
Public doc As Word.Document
Public FrstFlag, TxtFlag As Boolean
Dim LogLib, LogFile As String
Dim Zero_Str As String
Dim CurIndex_Int As Integer
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim Rng As Word.Range
'UnregisterHotKey(Me.Handle, 0)
UnregisterGlobalHotKey()
Try
If Trim(UCase(Set_Button.Text)) = "RE&SET" Then
'If TxtFlag Then
Rng = doc.Range
Rng.Collapse(Word.WdCollapseDirection.wdCollapseStart)
Rng.Delete()
TxtFlag = False
'End If
doc.SelectAllEditableRanges()
WordApp.Selection.ShapeRange.WrapFormat.Type = Word.WdWrapType.wdWrapSquare
doc.Save()
doc.Close()
FrstFlag = False
End If
Catch ex As NullReferenceException
End Try
-
Oct 20th, 2009, 01:44 AM
#9
-
Oct 20th, 2009, 01:52 AM
#10
Re: word application declaration error
Thread Moved
Do you have the PIA's installed on this new system? (link in my signature)
Do you have Option Explicit On in your Options?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 20th, 2009, 02:05 AM
#11
Re: word application declaration error
I doubt his machine doesnt have Winword Installed
Please mark you thread resolved using the Thread Tools as shown
-
Oct 20th, 2009, 02:38 AM
#12
Re: word application declaration error
If it didnt, he wouldnt have been able to add the Word reference unless the solution was just copied over to the new system without references being updated etc.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 20th, 2009, 02:45 AM
#13
Thread Starter
Lively Member
Re: word application declaration error
hi rob.. i have updated the word reference.. can u pls tell me wat are the reference need to update.
-
Oct 20th, 2009, 02:51 AM
#14
Re: word application declaration error
Can you verify that you have the Primary Interop Assemblies installed?
If not you will need to install them.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 30th, 2009, 02:33 AM
#15
Thread Starter
Lively Member
Re: word application declaration error
Thanks a lot.......now no errors:-) after publishing it when i try to install in a machiine it shows interop.word.dll is missing:-(
-
Oct 31st, 2009, 02:01 PM
#16
Re: [RESOLVED] word application declaration error
Did you package the PIAs for deployment on other systems that have Word installed?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|