Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    insertfile problems (Word 2000/VBA)

    I am having a problem with the VBA InsertFile object.

    Currently I use the following code to insert the required file:

    Selection.insertfile FileName:="Cocuments and Settingspgc.IANZApplication DataMicrosoftTemplatesIANZ TemplatesIANZCAR.doc", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False

    On reading the help it informs me that if I leave the path out eg. Selection.insertfile ("IANZCAR.doc")

    Word assumes that the file is in the same directory as the one your working in. This does not appear to work. Does anyone have any idea why?
    cheers

    Phil Carter

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: insertfile problems (Word 2000/VBA)

    Use CurDir to verify that the "current" folder is the one you think it is. Then use ChDir to change to the desired folder. Then you can use the Insertfile method without specifying the full path.

    I recommend using the full path anyway. Put it in a variable so your statement looks nice:

    Selection.InsertFile:= strFolder & strFile, Range:=, etc.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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