|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Visual Basic and WordCan I run a Word Document Macro from within Visual Basic.
If so, can you help or direct me to the documentation. Thanks -- Don Mylrea I may have found what I need in another post - Thanks.
-- Show quoteHide quoteDon Mylrea "Don" wrote: > Can I run a Word Document Macro from within Visual Basic. > > If so, can you help or direct me to the documentation. > > Thanks > -- > Don Mylrea On Tue, 31 Jan 2006 08:57:22 -0800, Don <D**@discussions.microsoft.com> wrote:
¤ Can I run a Word Document Macro from within Visual Basic. ¤ Yes, you can: http://support.microsoft.com/kb/177760/ Paul ~~~~ Microsoft MVP (Visual Basic) Thanks Paul
I'll give that a try. -- Show quoteHide quoteDon Mylrea "Paul Clement" wrote: > On Tue, 31 Jan 2006 08:57:22 -0800, Don <D**@discussions.microsoft.com> wrote: > > ¤ Can I run a Word Document Macro from within Visual Basic. > ¤ > > Yes, you can: > > http://support.microsoft.com/kb/177760/ > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) > Paul, Do I have to have Microsoft Word 97 Standard Edition to run the Macros
in Word. -- Show quoteHide quoteDon Mylrea "Paul Clement" wrote: > On Tue, 31 Jan 2006 08:57:22 -0800, Don <D**@discussions.microsoft.com> wrote: > > ¤ Can I run a Word Document Macro from within Visual Basic. > ¤ > > Yes, you can: > > http://support.microsoft.com/kb/177760/ > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) > "Don" <D**@discussions.microsoft.com> wrote in message From the looks of the code in that article, I'd say..... No. Since it uses news:0B1DAAD6-9446-4EB8-AA5F-71A5B58155B3@microsoft.com... > Paul, Do I have to have Microsoft Word 97 Standard Edition to run the > Macros > in Word. > -- > Don Mylrea late binding, it should work with any version of Access/Excel/Word -- Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm On Wed, 1 Feb 2006 07:50:04 -0800, Don <D**@discussions.microsoft.com> wrote:
¤ Paul, Do I have to have Microsoft Word 97 Standard Edition to run the Macros ¤ in Word. Microsoft Word needs to be installed since the process involves automation. I think the example just refers to Word 97, but any version from Word 97 forward should support this capability. Paul ~~~~ Microsoft MVP (Visual Basic) I have upgraded to Microsoft Office Word 2003 and am having trouble running a
macro from Visual Basic. My Code is: Dim WD As Object WD = CreateObject("Word.Application") WD.Documents.Open(C:\INSPECTION REPORT\PrintEcreateFiles.doc") WD.Run("Project.Module1.EcreateResidential") On the WD.Run line I Get the following Error: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll I also tried: Dim StrCommand As Object Dim MyDoc As String StrCommand = "Windword.exe C:\PrintEcreateFiles.doc/mEcreateResidencial" MyDoc = Shell(StrCommand.vbMaximizedFocus) I get the Error: An unhandled exception of type 'System.MissingMemberException' occurred in microsoft.visualbasic.dll Additional information: Public member 'vbMaximizedFocus' on type 'String' not found. Do I have the Proper Dim Statement for MyDoc? Can you guys help -- Show quoteHide quoteDon Mylrea "Don" wrote: > Can I run a Word Document Macro from within Visual Basic. > > If so, can you help or direct me to the documentation. > > Thanks > -- > Don Mylrea You're using VB.NET rather than VB 'classic' so you might be better off
trying on those newsgroups. A few suggestions anyway: (1) WD.Run("Project.Module1.EcreateResidential") Are you sure that the document has been opened with macros enabled? That would prevent you running the macro. (2) MyDoc = Shell(StrCommand.vbMaximizedFocus) This line should probably be: MyDoc = Shell(StrCommand, vbMaximizedFocus) (3) Personally, I wouldn't run a macro from VB (.NET or 6). I would bring the VBA code into VB. It makes troubleshooting and upgrading your code a lot easier. HTH Don wrote: Show quoteHide quote > I have upgraded to Microsoft Office Word 2003 and am having trouble running a > macro from Visual Basic. > > My Code is: > Dim WD As Object > WD = CreateObject("Word.Application") > WD.Documents.Open(C:\INSPECTION REPORT\PrintEcreateFiles.doc") > WD.Run("Project.Module1.EcreateResidential") > > On the WD.Run line I Get the following Error: > An unhandled exception of type 'System.Runtime.InteropServices.COMException' > occurred in microsoft.visualbasic.dll > > > I also tried: > Dim StrCommand As Object > Dim MyDoc As String > StrCommand = "Windword.exe C:\PrintEcreateFiles.doc/mEcreateResidencial" > MyDoc = Shell(StrCommand.vbMaximizedFocus) > > I get the Error: > An unhandled exception of type 'System.MissingMemberException' occurred in > microsoft.visualbasic.dll > > Additional information: Public member 'vbMaximizedFocus' on type 'String' > not > found. > > > Do I have the Proper Dim Statement for MyDoc? > > Can you guys help Thanks I'll try.
-- Show quoteHide quoteDon Mylrea "Gman" wrote: > You're using VB.NET rather than VB 'classic' so you might be better off > trying on those newsgroups. > > A few suggestions anyway: > (1) WD.Run("Project.Module1.EcreateResidential") > Are you sure that the document has been opened with macros enabled? That > would prevent you running the macro. > > (2) MyDoc = Shell(StrCommand.vbMaximizedFocus) > This line should probably be: > MyDoc = Shell(StrCommand, vbMaximizedFocus) > > (3) Personally, I wouldn't run a macro from VB (.NET or 6). I would > bring the VBA code into VB. It makes troubleshooting and upgrading your > code a lot easier. > > HTH > > > Don wrote: > > I have upgraded to Microsoft Office Word 2003 and am having trouble running a > > macro from Visual Basic. > > > > My Code is: > > Dim WD As Object > > WD = CreateObject("Word.Application") > > WD.Documents.Open(C:\INSPECTION REPORT\PrintEcreateFiles.doc") > > WD.Run("Project.Module1.EcreateResidential") > > > > On the WD.Run line I Get the following Error: > > An unhandled exception of type 'System.Runtime.InteropServices.COMException' > > occurred in microsoft.visualbasic.dll > > > > > > I also tried: > > Dim StrCommand As Object > > Dim MyDoc As String > > StrCommand = "Windword.exe C:\PrintEcreateFiles.doc/mEcreateResidencial" > > MyDoc = Shell(StrCommand.vbMaximizedFocus) > > > > I get the Error: > > An unhandled exception of type 'System.MissingMemberException' occurred in > > microsoft.visualbasic.dll > > > > Additional information: Public member 'vbMaximizedFocus' on type 'String' > > not > > found. > > > > > > Do I have the Proper Dim Statement for MyDoc? > > > > Can you guys help >
How to open file for output but not overwrite?
All About XP .. Do I just not get it? How to create an array of images Eliminate duplication in an array VB.NET Shutdown from text file How to protect software? multiline tooltip class is slow create directory using UNC path using word.application in VB |
|||||||||||||||||||||||