C
Cindy Meister
Hi all
VS 2003, Office 2003
I'm looking for a way to use WordBasic commands via C#. I found the
following discussion (May 2004) using Google
http://groups.google.ch/group/micro...=WordBasic+NET&rnum=32&hl=de#300613d42debd272
and tried Liana's suggestion in my code, as below. It compiles (which is
definitely an improvement!), but when I run this procedure
- The first message box works fine, and the file path is correct.
- I get an error in mscorlib on the second MessageBox with the text
'Unknown Name.'
Does anyone have any ideas that might help?
private void Pfadangaben(string pfadangabe)
{
MessageBox.Show(pfadangabe);
object wb = wdApp.WordBasic;
object [] argValues = new object[] {2000, 5, 5};
string [] argNames = new string[] {"Year", "Month", "Day"};
MessageBox.Show( (string) wb.GetType().InvokeMember("DateSerial()",
System.Reflection.BindingFlags.InvokeMethod,
null, wb, argValues, null, null, argNames));
//object[] argValues = new object[] {pfadangabe, 1};
//String [] argNames = new String [] {"Filename$", "InfoType"};
//MessageBox.Show((string) wb.GetType().InvokeMember("FileNameInfo$",
//System.Reflection.BindingFlags.InvokeMethod,null, wb, argValues, null,
null, argNames));
}
-- Cindy
VS 2003, Office 2003
I'm looking for a way to use WordBasic commands via C#. I found the
following discussion (May 2004) using Google
http://groups.google.ch/group/micro...=WordBasic+NET&rnum=32&hl=de#300613d42debd272
and tried Liana's suggestion in my code, as below. It compiles (which is
definitely an improvement!), but when I run this procedure
- The first message box works fine, and the file path is correct.
- I get an error in mscorlib on the second MessageBox with the text
'Unknown Name.'
Does anyone have any ideas that might help?
private void Pfadangaben(string pfadangabe)
{
MessageBox.Show(pfadangabe);
object wb = wdApp.WordBasic;
object [] argValues = new object[] {2000, 5, 5};
string [] argNames = new string[] {"Year", "Month", "Day"};
MessageBox.Show( (string) wb.GetType().InvokeMember("DateSerial()",
System.Reflection.BindingFlags.InvokeMethod,
null, wb, argValues, null, null, argNames));
//object[] argValues = new object[] {pfadangabe, 1};
//String [] argNames = new String [] {"Filename$", "InfoType"};
//MessageBox.Show((string) wb.GetType().InvokeMember("FileNameInfo$",
//System.Reflection.BindingFlags.InvokeMethod,null, wb, argValues, null,
null, argNames));
}
-- Cindy