+ Reply to Thread
Results 1 to 5 of 5

Discrepancy between Word and Excel syntax?

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Discrepancy between Word and Excel syntax?

    Edit: Cross-posted at http://www.mrexcel.com/forum/showthread.php?t=422923

    Hi All,

    I should disclaim that I'm quite novice at that, so my approach to writing macros is to record individual steps to determine the appropriate method, then copy and paste.

    In any event, I have a macro that creates a word doc from content in an excel file. I copied over the code for inserting a text field from the Word Macro Recorder:

    Please Login or Register  to view this content.
    And pasted it (with msWord):

    Please Login or Register  to view this content.
    When I attempt to run this I get a "wrong number of arguments or invalid property assignment" error at the line that attempts to add the text field. Is this because of a discrepancy in syntax between Word and Excel, or am I making some other mistake?

    Any help you can provide would be great. Thanks!
    Last edited by prawer; 10-15-2009 at 08:53 PM. Reason: Cross-posted

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Discrepancy between Word and Excel syntax?

    Thanks for including the link.......
    Last edited by daddylonglegs; 10-15-2009 at 07:52 PM.

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Discrepancy between Word and Excel syntax?

    My apologies all. Have added the link and will 'cross-close' if my issue gets resolved in either forum.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Discrepancy between Word and Excel syntax?

    Hello prawer,

    It would be best if you posted your workbook so the all the code is available for review..
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Discrepancy between Word and Excel syntax?

    The good folks at mrexcel (who are, of course, no more or less good than the good folks here ) pointed out that the second 'Selection' in the line needed a preceding period in order to go with 'with', as follows:

    Please Login or Register  to view this content.
    Cheers y'all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1