|
-
Mar 5th, 2004, 09:11 AM
#1
Thread Starter
Evil Genius
Word Problems
Hi All,
In project1, I use this to open a word file & run a macro - this works fine in both the vs.net ide for thi project1, and if I compile this to an exe file & call it using the shellexecute api from vb6, no problems whatsoever!
VB Code:
Dim objWrdApp as Microsoft.Office.Interop.Word.Application _
= new Microsoft.Office.Interop.Word.Application
objWrdApp.Documents.Open(CType(strWordFileName, system.object))
objWrdApp.Run (MacroName:="execConvEquations")
However, calling this from a second - new vb.net project using:
VB Code:
ProcessVariable "C:\MyCompiledApp", strWordFileNameVariable)
It comes up with the error Unable to run the specified macro. Can someone tell me how to ressolve this please?!?!?!
-
Mar 5th, 2004, 10:54 AM
#2
PowerPoster
Hi,
"Dim objWrdApp as Microsoft.Office.Interop.Word.Application _
= new Microsoft.Office.Interop.Word.Application"
I don't know much about Macros but I do know you cannot call anything declared as Private from another project. Surely you should declare it as "Public", "Shared" or "Protected"?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 5th, 2004, 11:19 AM
#3
Thread Starter
Evil Genius
This one's declared within sub Main() of project1 which then gets compiled - so this one's running as a standalone exe.
I'm then using process.start (more or less like shell, shellexecute in vb6) to open/run this file - I'm not inheriting or calling any of the code direct from my project.
Thanks for trying though anyhow.
-
Mar 5th, 2004, 11:55 AM
#4
PowerPoster
Hi,
Totally out of my depth but I have just referred to a manual and could it possibly be that
"ProcessVariable "C:\MyCompiledApp", strWordFileNameVariable)"
should be rearranged to
"ProcessVariable (strWordFileNameVariable, "C:\MyCompiledApp",)
EDIT:
I've just noticed that in your posted code
ProcessVariable "C:\MyCompiledApp", strWordFileNameVariable)
you have ommitted the first "("
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
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
|