Vbs check if file is empty




















Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Register now while it's still free! Already a member? Close this window and log in. Join Us Close. Join Tek-Tips Forums! Join Us! By joining you are opting in to receive e-mail. Thread starter davep Start date Mar 3, Joined Nov 2, Messages Hi, I am trying to write a line of code in VBA that opens a text file and checks if the file is blank.

To put this in context, the user selects a text file to import into Excel and if the file is blank I want to exit the function. I know I can import the file into Excel and check to see if the cells are blank, however it would be more efficient if I could simply check if the text file is blank before importing into Excel.

Thanks in advance, Dave. Excel Facts. How can you turn a range sideways? Click here to reveal answer. Copy the range. Select a blank cell.

Right-click, Paste Special, then choose Transpose. Perhaps something like this: Code:. Getfile x If f. Legacy Guest. For that, you might edit HP's code and use something like this Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Check if the file is empty Ask Question.

Asked 6 years, 6 months ago. Active 3 years, 5 months ago. Viewed 10k times. FileExists csFSpec Then document.



0コメント

  • 1000 / 1000