Bad Parameter Error 
Author Message
 Bad Parameter Error

I have the following code:

Private Sub cmdFaxE Click()
    Dim DD As Object
    Set DD = CreateObject("Word.Application")

    DD.Documents.Open Filename:="C:\My Documents\FaxPlate-AE.dot"
    DD.Selection.MoveDown Unit:=wdLine, Count:=6
    DD.Selection.Paste
    DD.ActiveDocument.Save
End Sub

I get an Error 4120 - "Bad parameter" note in connection with the "MoveDown"
code.

I'd really appreciate someone setting me straight.

Rgs,
Bob



Mon, 30 Dec 2002 03:00:00 GMT  
 Bad Parameter Error

Perhaps,
DD.ActiveDocument.Selection.MoveDown

HTH
Bob Dietz

Quote:

> I have the following code:

> Private Sub cmdFaxE Click()
>     Dim DD As Object
>     Set DD = CreateObject("Word.Application")

>     DD.Documents.Open Filename:="C:\My Documents\FaxPlate-AE.dot"
>     DD.Selection.MoveDown Unit:=wdLine, Count:=6
>     DD.Selection.Paste
>     DD.ActiveDocument.Save
> End Sub

> I get an Error 4120 - "Bad parameter" note in connection with the "MoveDown"
> code.

> I'd really appreciate someone setting me straight.

> Rgs,
> Bob



Mon, 30 Dec 2002 03:00:00 GMT  
 Bad Parameter Error

Hi Bob,

Quote:
> DD.Selection.MoveDown Unit:=wdLine, Count:=6

Are there actually six lines below the insertion point (Selection) when
you issue this command? Is the Word window .Visible? Not-nice-things
happen when using the Selection object like this and .Visible = False
for the Word application.

Maybe you'd be better off setting a bookmark as the "target" for
whatever you're pasting?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)



Tue, 31 Dec 2002 03:00:00 GMT  
 Bad Parameter Error

Hi Cindy,

There are more than six lines below the insertion point.

The Word window was not visible, so I added "DD.ActiveWindow.Visible = True"
after the Open filename... line.

But I still get the Error 4120.

How would I set a bookmark as the "target"? I don't know how to do this.

Thanks for your help.

Bob Mignault



Quote:
> Hi Bob,

> > DD.Selection.MoveDown Unit:=wdLine, Count:=6

> Are there actually six lines below the insertion point (Selection) when
> you issue this command? Is the Word window .Visible? Not-nice-things
> happen when using the Selection object like this and .Visible = False
> for the Word application.

> Maybe you'd be better off setting a bookmark as the "target" for
> whatever you're pasting?

> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister
> http://go.compuserve.com/MSOfficeForum

> This reply is posted in the Newsgroup; please post any follow question
> or reply in the newsgroup and not by e-mail :-)



Tue, 31 Dec 2002 03:00:00 GMT  
 Bad Parameter Error

Hi Bob,

Quote:
> How would I set a bookmark as the "target"? I don't know how to do this.

The following assumes a bookmark named "InsertHere" in the template.

-----------------------------------------------------------------
Dim oWord As Object
Dim oDoc As Object

Set oWord = CreateObject("Word.Application")

Set oDoc = oWord.Documents.Open _
            (FileName:="C:\My Documents\FaxPlate-AE.dot")

oDoc.Bookmarks("InsertHere").Range.Paste
oDoc.Save

-----------------------------------------------------------------

One point - what you are doing is opening/modifying the *template*. If you
want to to create a new document based on the template, use Documents.Add
instead of Documents.Open.

--
Hope this helps.
Regards
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.



Wed, 01 Jan 2003 03:00:00 GMT  
 Bad Parameter Error
Hi ibby

Everything now works fine!

Many thanks for your help.

Regards,

Bob Mignault


Quote:
> Hi Bob,

> > How would I set a bookmark as the "target"? I don't know how to do this.

> The following assumes a bookmark named "InsertHere" in the template.

> -----------------------------------------------------------------
> Dim oWord As Object
> Dim oDoc As Object

> Set oWord = CreateObject("Word.Application")

> Set oDoc = oWord.Documents.Open _
>             (FileName:="C:\My Documents\FaxPlate-AE.dot")

> oDoc.Bookmarks("InsertHere").Range.Paste
> oDoc.Save

> -----------------------------------------------------------------

> One point - what you are doing is opening/modifying the *template*. If you
> want to to create a new document based on the template, use Documents.Add
> instead of Documents.Open.

> --
> Hope this helps.
> Regards
> ibby

> Please post replies or follow-ups to the **newsgroup** so that
participants
> may benefit or contribute.



Wed, 01 Jan 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Bad Parameter Error

2. Bound Controls: bad,bad,bad

3. RDO bad, bad, bad

4. RDO bad, bad, bad

5. Bad parameters return code in VB5?

6. Pull Bad-Password-Time and Bad-Password-Count

7. Run-time error '49': Bad DLL calling convention

8. My Worst Nightmare: Error Accessing File

9. Bad error - any advice?

10. Access200 - Error 49: "Bad DLL calling..."

11. Error 429: Help with bad DAO350.dll registration

12. error Bad Shapesheet name

 

 
Powered by phpBB® Forum Software