![]() |
Command Button- Open Word Doc
Hi, I'm pretty good at VBA, but I'm experiencing something new. I'm designing
an Outlook form on our Terminal Server. I was getting ready to insert some code for a command button, similar to the thread "XLsheet Button Control to Lauch form the Public Drive" in this forum. I'll be openinging a Word Doc instead, but when I went to view the code, I got "Microsoft Script Editor, " instead of the vba code interface. How does this work? Does it use the same basic format? I also am worried that the Outlook "Use Word as the email editor" option might give me problems, since Word will be open already. Here is the rough draft of the code I was thinking of using. Any help would be appreciated! Private Sub cmdHandbook_Click Dim WApp as Word.Application Dim stFilename, stPath as String stPth = "P:\Public Documents\Staff\New Hire\" stFilename = "Employee Handbook.doc" Set WApp = New Word.Application With WApp .Documents.Open(FileName: stpath & stFilename, ReadOnly:=True) .Visible=true End With End Sub Unfortunately, this doesn't work. When I "run this form" I get a popup "Expected End of Statement: Line No. 2", and yes of course I used the real path and real doc name :) Office 2003, btw. Thanks in advance! |
All times are GMT +1. The time now is 09:46 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com