GMAIL vba获取当前用户并返回用户的Gmail地址

时间:2016-06-24 17:23:02

标签: excel-vba gmail vba excel

我有从Excel VBA中生成GMail电子邮件的代码,但是,我正在寻找能够确定当前用户是谁并返回当前用户的Gmail电子邮件地址的代码。

1 个答案:

答案 0 :(得分:0)

我不知道是否有办法从代码中获取GMAIL地址,除非他们的浏览器窗口打开了他们的GMAIL帐户

Microsoft示例代码以获取当前用户名

   $curl_post_data_nc = array(
    "person" => array(
        "title" => "$val_nc_persontitle",
        "nationalNr" => NULL,
        "firstName" => "$val_nc_personfirstname",
        "lastName" => "$val_nc_personsurname",
        "birthDate" => "$new_val_nc_persondob"
    ),

    "company" => array(
        "type" => "$val_nc_companytype",
        "name" => "$val_nc_companyname",
        "vat" => "$val_nc_companyvat",
        "nace" => "$val_nc_companynace",
        "website" => NULL
    ),

    "contact" => array(
            "email" => "$val_nc_personemail",
            "mobile" => "$val_nc_personphone",
            "telephone" => NULL
    ),

    "contract" => array(
        "referenceDate" => "$val_nc_refdate",
        "startDate" => "$val_nc_startdate"
    ),

    "payment" => array(
        "paymentMethodEmail" => false,
        "paymentMethodMail" => true,
        "paymentInterval" => "$val_nc_paymentbilling",
        "method" => "$val_nc_paymentmethod",
        "accountNr" => $val_nc_result = ($val_nc_paymentmethod == 'TRANSFER') ? NULL : "$val_nc_iban"
    ),

    "deliveryAddress" => array(
        "building" => "HOUSE",
        "street" => "$val_nc_personstreet",
        "streetNr" => "$val_nc_personstreetnr",
        "floor" => NULL,
        "boxNr" => NULL,
        "localityCode" => "$val_nc_personpostcode",
        "localityName" => "$val_nc_personlocality"
    ),

    "invoiceAddress" => array(
        "sameAsDelivery" => false,
        "building" => "HOUSE",
        "street" => "$val_nc_billstreet",
        "streetNr" => "$val_nc_billstreetnr",
        "floor" => NULL,
        "boxNr" => NULL,
        "localityCode" => "$val_nc_billpostcode",
        "localityName" => "$val_nc_billlocality"   
    ),

    "gasMeter" => array(
        "ean" => "$val_nc_ean",
        "nr" => NULL,
        "type" => "gas",
        "electric" => NULL,
        "gas" => array(
                   "usage"   => $val_nc_gasusage,
                   "formula" => "TTF103532"
                )  
    ),