PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Error 4605 This command is not available, when opening Word Template-VBForums
Results 1 to 5 of 5

Thread: Error 4605 This command is not available, when opening Word Template

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    2

    Question Error 4605 This command is not available, when opening Word Template

    I'm using the code below to either use the existing instance or to create a new instance of Word then open a document template. On the "Set WordDoc" line of code I'm receiving error 4605, This command is not available. I can't make the error happen all of the time. It seems to happen the most when I've first opened VB and Word isn't open. However, it can happen when Word is open even though I've been able to produce a few different copies of the same report with the Word instance. The problem isn't limited to just one template either. I'm using VB 5 SP 3 and Word 97 SR-2. Please let me know if you have any recommendations.


    On Error Resume Next

    Set WordObj = GetObject(, "Word.Application")

    WordObj.Visible = True

    DoEvents

    If Err.Number <> 0 Then
    Set WordObj = New Word.Application
    WordObj.Visible = True
    Err.Clear
    End If

    Set WordDoc = WordObj.Documents.Add(App.Path & "\Templates\Letter.dot")

  2. #2
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    Press F8 to determine where the erro is.
    Where does the program stop,?>
    i suggest its .. WordObj.Visible = True .. move it, or comment it out

    Any one else?


    Seahag

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Commenting the WordObj.Visible = True didn't help. The error is on the "Set WordDoc = WordObj.Documents.Add(App.Path & "\Templates\Letter.dot")" line.

  4. #4
    WorkHorse
    Guest
    Are you by chance using Word as your Outlook editor, or maybe opening Word files in Netscape using NCompass? I believe the GetObject function will pick up instances of Word used in these type of situations, but Word can't do all the things it normally can when it is actually in Outlook or NCompass.

  5. #5
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    Dont know word all that well.

    VB Code:
    1. Documents.Add Template:="C:\Program Files\Microsoft Office" _
    2.     & "\Templates\Memos\Professional Memo.dot"
    3.  
    4. or
    5.  
    6. Documents.Open FileName:="C:\MyFiles\MyDoc.doc", ReadOnly:=True

    I found that in the help

    That is all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width