vendredi 26 mai 2017

Visual Basic Doesn't Recognize If Statement

My VBA code, copied from http://ift.tt/1tKpygU, will open the excel sheet but also says the strPath doesn't exist. It is supposed to autopopulate with some information from the emails but nothing is inputted. I have used both of these paths (the reason is beneath them).

    strSheet = "Job.xlsx"
    strPath = "C:\Users\name\Documents\"
    strSheet = strPath & strSheet

    strSheet = "Job.xlsx"
    strPath = "C:\Users\user\Desktop\"
    strSheet = strPath & strSheet

The location (from right-click, then selecting properties) is:
C:\Users\user\Desktop .... This opens up the sheet, but nothing is autopopulated

If I open up the sheet, and go to options -> save, then the default location is: C:\Users\user\Documents .... This doesn't open up the sheet

My questions:

  1. Why is the pathway not recognized?

  2. And why is the auto-population not working?

I assume the second one is intrinsically tied to the first question but if it isn't, I verbatim copied the code from the URL in the first line and plan on customizing after getting a working prototype.

Aucun commentaire:

Enregistrer un commentaire