dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] compile error syntax error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    9

    Resolved [RESOLVED] compile error syntax error

    I posted this one yesterday about the EA in the first line of the code and removed the " before the EA. I tried the macro again and received compile and syntax error? (and the first line is highlighted ending with "Origin". This macro worked before i changed it to have the file open the current day. (first line) since then it hasn't worked. so I change the date manually every day before I run it.

    any ideas?

    Workbooks.OpenText Filename:="X:\xfiles\sha\tor\hldovr\EA" & format(now(), "yymmdd") & ".TXT", Origin
    :=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
    , ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:= _
    True, Space:=False, Other:=True, OtherChar:=")", FieldInfo:=Array(Array _
    (1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8 _
    , 1), Array(9, 1)), TrailingMinusNumbers:=True
    ChDir "S:\MMCR\Toronto\Holdover"
    Workbooks.Open Filename:="S:\MMCR\Toronto\Holdover\Master_Holdover.xls", _
    UpdateLinks:=0, Origin:=xlWindows
    Workbooks.Open Filename:="S:\MMCR\Toronto\Holdover\NAV.xls", UpdateLinks:=0 _
    , Origin:=xlWindows
    Windows("EA080610.TXT").Activate
    Windows("NAV.xls").Activate
    Windows("Master_Holdover.xls").Activate
    Sheets("Data").Select
    Range("A2").Select
    Windows("EA080610.TXT").Activate

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: compile error syntax error

    Moved To Office Development
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: compile error syntax error

    The first line missing line continuous character (space)_
    Code:
    ...Origin _
    Rewrite it like this will be easier to see:
    Code:
    Workbooks.OpenText Filename:="X:\xfiles\sha\tor\hldovr\EA" & format(now(), "yymmdd") & ".TXT", _
    Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
    ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True, Space:=False, _
    Other:=True, OtherChar:=")", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), _
    Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1)), _
    TrailingMinusNumbers:=True
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    Baby Steps a guided tour
    IsDigits() and IsNumber() functions Wichmann-Hill Random() function >> and << functions for VB CopyFileByChunk

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