Consulting

Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 40 of 61

Thread: Merge saved as seprate file?

  1. #21
    I get an error message when I try to run
    debug
    .SaveAs FileName:=DocName, FileFormat:=wdFormatDocument

    ?docname
    F:\My Documents\Test\Merge Eagle Hawk Angeleah Rose 10/15/2007 .doc
    It looks alright?

  2. #22
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    A Filename cannot contain a / character.

    If they are in your document and there's nothing you can do about it they can be removed in the code (or changed to another character, a hyphen perhaps).
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  3. #23
    no its not in the file name so it's in the macro I cut and pasted it and then changed the drive I will retry now that I am home

  4. #24
    oh its in the date eh?

  5. #25
    OK I changed the date and tried to run it and I get
    ambiguous name detected CreateDocnameAndEmail

    and yes it would be great if did something to note no email address

  6. #26
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Ambiguous name probably means you have two macros with the same name.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  7. #27
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Perhaps you could change ..
    [VBA]If MailTo <> "" Then [/VBA]
    to
    [VBA]
    If MailTo = "" Then
    Msgbox "Document " & DocName & " not e-mailed. No mail id found"
    Else
    [/VBA]
    If you may have lots you may want something more sophisticated.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  8. #28
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    I thought ambiguous always meant there are two identical names. Although why the text of the error does not simply SAY that, I don't know.

    ...it is...ummmm, ambiguous.

  9. #29

    Error message

    I still get and I can find the error .. I removed the / and made sure the path is correct any ideas?

    .SaveAs FileName:=DocName, FileFormat:=wdFormatDocument

  10. #30
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Yes I have never understood the ambiguity as opposed to the duplicity.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  11. #31
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    What is the DocName now?
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  12. #32
    "C:\Documents and Settings\Administrator\My Documents\Test " & myRange.Text & ".doc"

  13. #33
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Yes, but what value does myRange.text have when it errors?
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  14. #34
    I thought I should clarify when try to run macro I get this error message
    Run-time error 4198 command failed

    When I do debug I get this highlighted yellow
    .SaveAs FileName:=DocName, FileFormat:=wdFormatDocument


    ?docname
    C:\Documents and Settings\Administrator\My Documents\Test Eagle Hawk Angeleah Rose Oct 15, 2007.doc

    So I have checked path, seems correct.
    What else should I look at ?

  15. #35
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    I hate "Command failed" messages - they give you nothing to go on.

    Do you have authority to write to Administrator files?
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  16. #36
    Yes it is the same file name used for the first macro and that worked

  17. #37
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    So the file already exists? That could explain it.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  18. #38
    What I meant is I used the same folders as the other one the folders are empty so the file does not already exist. I made the folders so it would have some place to put it

  19. #39

    Earlier question

    Quote Originally Posted by TonyJollans
    Yes, but what value does myRange.text have when it errors?
    myRange.Text
    When it gives the error message is the email address

  20. #40
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    But you don't want to be saving as the e-mail address. @ is not a valid character in a filename which will be why it fails.

    Can you post exactly the code you are using when it fails?
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

Posting Permissions

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