troubleshooting Question

VBA check for empty datasource

Avatar of Allan Stohn
Allan StohnFlag for Denmark asked on
VBAMicrosoft WordMicrosoft Office
6 Comments2 Solutions127 ViewsLast Modified:
Hi experts

We are using VBA in Word 2013 to automate letters and so on. Data is exported from our system to csv files. I've run into an issue where the csv file only holds the dataname (first line) but no actual data. When I then run this command:

ActiveDocument.MailMerge.OpenDataSource Name:=MyDataSource

We get a popup asking to correct the datasource. Is there a way to check if the datasource is empty and then handle it from there, so it doesn't interrupt the script?

Word-pop-up.png(This is the pop-up, that I'm trying to avoid. It's in Danish, sorry for that)


Thx.

Allan
ASKER CERTIFIED SOLUTION
Allan Stohn
Lawyer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros