• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

file extension "xlsb" not valid

DE_Tx

Member
Interesting occurrence today and I cannot figure out why, thus I am here.

I have a simple macro to save a file to a certain location with the current date - 1 as part of the name. The macro works when my file starts out as an xlsx type, but if I start a new file as binary (my default file type), dump in all my data and run the macro, it gives me a 1004 run time error and says the file type is not valid.

Here is the line from the code that is giving me problems:

Code:
"S:\folder\folder2\folder3\2016-08 Aug\filename " & Format(Now() - 1, "MMDD") & ".XLSB"

Any ideas as to why this would work when my file starts as an xlsx and not when it is already an xlsb?
 
Hi ,

The line of code you have posted is not a valid line of code because it is just a string ; you need to precede it with a variable assignment or an action such as a File Save.

Can you post the entire macro ?

Or alternatively , when the error message is displayed , click on Debug , and in the Immediate window , enter :

?"S:\folder\folder2\folder3\2016-08 Aug\filename " & Format(Now() - 1, "MMDD") & ".XLSB"

and see what is displayed.

Narayan
 
Thank you for the quick response Narayan. That solves it.
Much obliged.

TcO
ps - I forgot to show the File Save As in my earlier post, but I did have it.
 
Back
Top