PerlIsGood
Programmer
This post continued from the following VBScript forum. I just thought someone over here might be able to help:
thread329-200792 The following code is written within a custom Outlook form. Everything works, I just need some fine-tuning.
I only have two problems with this:
1. The code opens the doc successfully, but does not pull the window up and make it the focus (unless Word was not open). How do I set the focus/make this window the active window?
2. Has anyone ever worked with Word form fields before? I can only seem to insert text before/after the bookmark. Does anyone know of a way to replace/insert text inside the form field?
thread329-200792 The following code is written within a custom Outlook form. Everything works, I just need some fine-tuning.
Code:
FileLoc = Server & FormFiles & "formschedule.doc"
On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
Set oWord = CreateObject("Word.Application")
End If
oWord.Documents.Open (FileLoc)
oWord.ActiveDocument.Bookmarks("var1").Select
oWord.Selection.InsertBefore (var1)
oWord.Visible = True
Set oWord = Nothing
I only have two problems with this:
1. The code opens the doc successfully, but does not pull the window up and make it the focus (unless Word was not open). How do I set the focus/make this window the active window?
2. Has anyone ever worked with Word form fields before? I can only seem to insert text before/after the bookmark. Does anyone know of a way to replace/insert text inside the form field?