Macros not in instance of Word

memanwar

New member
Joined
Dec 29, 2003
Messages
3
I have an VB.NET application that creates Word XP documents. Signing on my computer (Windows NT) as an "admin" allows me to run the letter writing process. However, if I use my own user login, the process fails. The routines/macros are missing. "Info: Member not found"

Exception Information
System.Runtime.InteropServices.COMException (0x80020003): Member not found.

--Set m_curDoc to new instance of Word.Application.Document with the selected document name.

m_curDoc = m_appWord.Documents.Open(strDoc)

--Run VBA code from generated instance of Word.Application
m_appWord.Run("InitParams", WrkDir, Connstr, ISEdit, AppPath, LttrID, Global.DatabaseType)

Any suggestions? What may be different between these two settings?
 
Whenever you are using something that has API you must have full trust for the application.... use the Microsoft.NET Configuration tool in your Administrative Tools to give that application full trust... it all gets into security policies... had that problem in the past... dont know how to fix it via code though... Im not a security guru... somebody may be able to help you with that... I think its something in the assembly... like security=demand full trust or something like that????
 
Hi - I had a similar problem. I have a simple project that manipulates Adobe Illustrator that works fine at home on Windows XP Pro (with admin login), but gives me an error (error message and source code below) at work with Windows Pro 2000 (user login). Im a novice, so Im pulling my hair out trying to figure out why I get "Member not found" still. What Ive checked:

- Same version of Illustrator on both machines (v10)
- Same version of .NET on both machines (v1.1)
- Gave the assembly (both .exe and .dll) full rights with .NET Configuration utility (at work)
- Made sure Interop.Illustrator.dll is in same directory as app (as you can see, the error message says its loaded)

I dont think its a security issue as the app does run, does load Illustrator and does create a new document. But like I said, it works perfectly fine at home.

Thanks for your help in advance!

Cliff


----------------------------------------------------------
ERROR MESSAGE AT WORK:
----------------------------------------------------------

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.Runtime.InteropServices.COMException (0x80020003): Member not found.
__ at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
__ at Illustrator._Brushes.RemoveAll()
__ at PrintFinalPdf.Final_PDF.PrintPdf(String strPubChoice)
__ at PrintFinalPdf.Final_PDF.ValidateInput()
__ at PrintFinalPdf.Final_PDF.btnPrint_Click(Object sender, EventArgs e)
__ at System.Windows.Forms.Control.OnClick(EventArgs e)
__ at System.Windows.Forms.Button.OnClick(EventArgs e)
__ at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
__ at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
__ at System.Windows.Forms.Control.WndProc(Message& m)
__ at System.Windows.Forms.ButtonBase.WndProc(Message& m)
__ at System.Windows.Forms.Button.WndProc(Message& m)
__ at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
__ at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
__ at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
___ Assembly Version: 1.0.3300.0
___ Win32 Version: 1.0.3705.288
___ CodeBase: file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
PrintFinalPdf
___ Assembly Version: 1.0.1486.28950
___ Win32 Version: 1.0.1486.28950
___ CodeBase: file:///C:/Documents%20and%20Settings/cliffb/Desktop/Trader%20Tools/PrintFin
alPdf.exe
----------------------------------------
System.Windows.Forms
___ Assembly Version: 1.0.3300.0
___ Win32 Version: 1.0.3705.288
___ CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e
089/system.windows.forms.dll
----------------------------------------
System
___ Assembly Version: 1.0.3300.0
___ Win32 Version: 1.0.3705.288
___ CodeBase: file:///c:/winnt/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
___ Assembly Version: 1.0.3300.0
___ Win32 Version: 1.0.3705.288
___ CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/sy
stem.drawing.dll
----------------------------------------
Microsoft.VisualBasic
___ Assembly Version: 7.0.3300.0
___ Win32 Version: 7.00.9502
___ CodeBase: file:///c:/winnt/assembly/gac/microsoft.visualbasic/7.0.3300.0__b03f5f7f11d5
0a3a/microsoft.visualbasic.dll
----------------------------------------
Interop.Illustrator
___ Assembly Version: 1.0.0.0
___ Win32 Version: 1.0.0.0
___ CodeBase: file:///C:/Documents%20and%20Settings/cliffb/Desktop/Trader%20Tools/Interop.
Illustrator.DLL
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this application or machine (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration>
___ <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the machine rather than being handled by this dialog.


----------------------------------------------------------
SOURCE CODE (I omitted the Windows Form generated code):
----------------------------------------------------------

Public Class Final_PDF
Inherits System.Windows.Forms.Form

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrint.Click
ValidateInput()
End Sub

Sub ValidateInput()
txtDtp.Focus()
If Not IsNumeric(txtDtp.Text) = True Then
MsgBox("Please enter a DTP number.", MsgBoxStyle.Exclamation,
"Warning")
txtDtp.Focus()
txtDtp.SelectAll()
ElseIf lbxPub.SelectedItem = "-----------------------" Then
MsgBox("Please choose a publication.", MsgBoxStyle.Exclamation,
"Warning")
Else
PrintPdf(lbxPub.SelectedItem.ToString)
End If
End Sub

Sub PrintPdf(ByVal strPubChoice As String)

launch illustrator and create preferences
Dim appRef As New Illustrator.Application()
Dim docRef As Illustrator.Document
Dim rulerPrefs As Illustrator.AiRulerUnits = Illustrator.AiRulerUnits.aiUnitsPoints
Dim alertPrefs As Illustrator.AiUserInteractionLevel
Dim colorPrefs As Illustrator.AiColorModel
Dim savePrefs As Illustrator.AiSaveOptions
Dim printPrefs As Illustrator.AiPostScriptLevel

rulerPrefs = Illustrator.AiRulerUnits.aiUnitsPoints
colorPrefs = Illustrator.AiColorModel.aiProcess
alertPrefs = Illustrator.AiUserInteractionLevel.aiDontDisplayAlerts
savePrefs = Illustrator.AiSaveOptions.aiDoNotSaveChanges

create new document
docRef = appRef.Documents.Add

remove unused materials
docRef.Swatches.RemoveAll()
docRef.Symbols.RemoveAll()
docRef.Patterns.RemoveAll()
docRef.ArtStyles.RemoveAll()
docRef.Brushes.RemoveAll()

determine pdf path
Dim pdfPath As String
Dim pubChoice As String

Select Case strPubChoice
Case "REG GLOSS"
pdfPath = "\\work\path\1\"
pubChoice = "pub1"
Case "REG GUTS"
pdfPath = "\\work\path\2\"
pubChoice = "pub2"
Case "NHG GLOSS"
pdfPath = "\\work\path\3\"
pubChoice = "pub3"
Case "NHG GUTS"
pdfPath = "\\work\path\4\"
pubChoice = "pub4"
End Select

create pdf info text
Dim pdfInfo As Illustrator.TextArtItem
pdfInfo = docRef.TextArtItems.Add
pdfInfo.Contents = "FINAL PDF | DTP: " & txtDtp.Text & " |
PUBLICATION: " & pubChoice
pdfInfo.Left = 24
pdfInfo.Top = 768

create date text
Dim dateText As Illustrator.TextArtItem
dateText = docRef.TextArtItems.Add
dateText.Left = 465
dateText.Top = 768
dateText.Contents = Today().ToShortDateString & " | " & Now().ToShortTimeString

create placed dtp art
Dim pdfFullPath As String = pdfPath & txtDtp.Text & ".pdf"
Try
Me.Hide()
docRef.GroupItems.CreateFromFile(pdfFullPath)
docRef.PrintOut() False was the option
docRef.Close(savePrefs)
Catch
MsgBox("The file " & pdfFullPath & " does not exist." & vbCrLf & "Make sure the PDF was processed and the DTP is correct.", MsgBoxStyle.Exclamation, "Warning")
docRef.Close(savePrefs)
End Try
Me.Close()
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub mnuMainFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuMainFileExit.Click
Me.Close()
End Sub

Private Sub txtDtp_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtDtp.Enter
txtDtp.SelectAll()
End Sub

End Class
 
Just a note: when I double click the short cut for Microsoft .NET Framework Configuration in Adimistrator Tools, it does nothing.
 
Have you found a soln yet ?

Hi there,
im currently facing the same problem as you were. Was wondering if youve found a solution for it as yet ?

Would appreciate any help.

Regards,
Hiren.
 
Back
Top