Forum Discussion

pedrohrmoreira's avatar
pedrohrmoreira
Copper Contributor
May 19, 2020

Compile Error: Expection: Expression in VBA. Highlights the "?"

Hi all,

 

I'm in the process of writing some code for a saveas function, so that it saves in specific folders by date. 

 

At the end of the code, I keep getting the "Compile Error: Expected: Expression" message whilst it highlights the "?" in the code. Please see screenshot attached.

 

Can somebody advise on what I am doing wrong? 

 

Many thanks,

Pedro M.

 

1 Reply

  • bhushan_z's avatar
    bhushan_z
    Iron Contributor

    pedrohrmoreira seems like you have pressed "Enter" in a line, which is not allowed.

    Refer below screenshot, i have put 2 red circles.
    Circle 1: Seems like you have pressed "Enter" - hence the error
    Circle 2: This is how use break the line, with the use of "_"

    Let me know if error is still there, if possible please share the file.

     

     

Resources