Home

Macro issue with email connectivity

%3CLINGO-SUB%20id%3D%22lingo-sub-886516%22%20slang%3D%22en-US%22%3EMacro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-886516%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22message%20spacer-32-top%22%3E%3CDIV%3E%3CDIV%20class%3D%22message-content%22%3E%3CDIV%3E%3CDIV%20class%3D%22ac-container%22%3E%3CDIV%20class%3D%22ac-textBlock%22%3E%3CP%3Eso%20i%20have%20a%20macro%20that%20i%20send%20each%20day%20for%20work%20-%20it's%20on%20my%20excel%20spreadsheet.%20it's%20supposed%20to%20automatically%20send%20my%20pnl%20sheet%20to%20the%20designated%20people%20on%20email.%20it%20works%20fine%20on%20my%20home%20laptop%2C%20but%20here%20on%20this%20computer%20it%20doesn't%20work%20for%20some%20reason%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22message%20spacer-32-top%22%3E%3CDIV%3E%3CDIV%20class%3D%22message-content%22%3E%3CDIV%3E%3CDIV%20class%3D%22ac-container%22%3E%3CDIV%20class%3D%22ac-textBlock%22%3E%3CP%3Enot%20sure%20if%20it's%20because%20there%20is%20an%20issue%20that%20the%20email%20is%20not%20linked%20somehow%3F%20or%20that%20maybe%20my%20antivirus%20is%20blocking%20-%26nbsp%3B%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-886516%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Emacro%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-887469%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-887469%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BUnfortunately%2C%20that's%20not%20much%20to%20go%20on...Does%20the%20code%20error%3F%20If%20so%2C%20what's%20the%20error%3F%20If%20it%20doesn't%20throw%20an%20error%2C%20but%20doesn't%20do%20anything%20else%20either%2C%20then%20I'd%20suggest%20stepping%20through%20the%20code%20with%20F8.%20It%20will%20help%20point%20you%20in%20the%20right%20direction.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt'll%20also%20help%20if%20you%20posted%20the%20code.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891460%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891460%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BCan%20you%20explain%20the%20%22step%20through%20the%20code%20with%20F8%22%3F%26nbsp%3B%20I'm%20not%20a%20techie%2C%20so%20not%20sure%20what%20that%20means.%26nbsp%3B%20When%20I%20click%20%22send%20PNL%22%2C%20nothing%20happens.%26nbsp%3B%20I%20then%20tried%20to%20click%20F8%20as%20you%20mentioned%2C%20but%20nothing%20happened%20so%20I'm%20assuming%20there%20is%20something%20else%20I%20need%20to%20do%20here%20to%20gather%20the%20code.%26nbsp%3B%20Pls%20advise.%26nbsp%3B%20Thanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891483%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891483%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BI'd%20first%20check%20and%20make%20sure%20your%20macro%20is%20assigned%20to%20the%20%22Send%20PNL%22%20button.%20If%20that%20doesn't%20fix%20it%2C%20then%20press%20Alt%2BF11%20to%20open%20the%20VB%20Editor%2C%20then%20find%20the%20module%20with%20your%20mail%20routine%20in%20it.%20Once%20there%2C%20pressing%20F8%20will%20step%20through%20the%20code%20one%20line%20at%20a%20time%2C%20so%20you%20can%20see%20what's%20going%20on.%20If%20the%20code%20throws%20an%20error%20you'll%20be%20able%20to%20see%20where.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFYI%20-%20Pressing%20F8%20in%20Excel%20toggles%20Extend%20Selection.%20I%20point%20that%20out%20because%20it%20can%20drive%20you%20nuts%20if%20you%20turn%20it%20on%20and%20don't%20realize%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891528%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891528%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESub%20sendpnlemailandprint()%3C%2FP%3E%3CP%3E'%20sendemailtopositions%20Macro%3CBR%20%2F%3E'%20Macro%20recorded%203%2F19%2F2010%20by%20d.namdar%3CBR%20%2F%3E'%20Mail_SheetsArray()%3C%2FP%3E%3CP%3EDim%20strDate%20As%20String%3CBR%20%2F%3EDim%20strDate2%20As%20String%3CBR%20%2F%3EActiveWorkbook.Save%3CBR%20%2F%3ESheets(Array(%22POSIT%22%2C%20%22RECAP%22%2C%20%22-P%26amp%3BL-%22%2C%20%22MTD%22)).Copy%3CBR%20%2F%3EstrDate%20%3D%20Format(Date%2C%20%22mm-dd-yy%22)%20%26amp%3B%20%22%20%22%20%26amp%3B%20Format(Time%2C%20%22h-mm-ss%22)%3CBR%20%2F%3EstrDate2%20%3D%20Format(Date%2C%20%22mm-dd-yy%22)%3CBR%20%2F%3EActiveWorkbook.SaveAs%20%22Todd%20PnL%20%22%20%26amp%3B%20ThisWorkbook.Name%20_%3CBR%20%2F%3E%26amp%3B%20%22%20%22%20%26amp%3B%20strDate2%20%26amp%3B%20%22.xlsx%22%3CBR%20%2F%3EActiveWorkbook.SendMail%20Array%20(I%20removed%20the%20actual%20email%20addresses%20here%20fyi)%3CBR%20%2F%3E%22Pierce%20P%2FL%20%22%20%26amp%3B%20strDate2%3CBR%20%2F%3EActiveWorkbook.ChangeFileAccess%20xlReadOnly%3CBR%20%2F%3EKill%20ActiveWorkbook.FullName%3CBR%20%2F%3EActiveWorkbook.Close%20False%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20know%20what%20you%20think.%26nbsp%3B%20And%20do%20you%20work%20for%20microsoft%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891843%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891843%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BYour%20code%20looks%20fine%20to%20me.%20What%20happened%20when%20you%20stepped%20through%20it%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20yes%2C%20I%20do%20work%20for%20Microsoft.%20I%20manage%20all%20the%20support%20content%20for%20Excel.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891855%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891855%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BNot%20sure%20what%20you%20mean%20when%20u%20say%20%22stepped%20thru%20it.%22%26nbsp%3B%20Basically%20i%20click%20on%20it%20and%20the%20email%20should%20be%20sent%2C%20but%20just%20nothing%20happens.%26nbsp%3B%20The%20process%20works%20totally%20fine%20on%20my%20home%20laptop%2C%20but%20not%20at%20my%20work%20setup.%26nbsp%3B%20Let%20me%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20do%20you%20remote%20in%20ever%20to%20solve%20problems%20(or%20does%20someone%20on%20your%20team)%3F%26nbsp%3B%20Guessing%20it%20would%20be%20a%20lot%20easier%20for%20a%20tech%20to%20make%20sense%20of%20all%20this%20and%20fix.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-891949%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-891949%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BStep%20though%3A%26nbsp%3B%3CSPAN%3Epress%20Alt%2BF11%20to%20open%20the%20VB%20Editor%2C%20then%20find%20the%20module%20with%20your%20mail%20routine%20in%20it.%20Once%20there%2C%20pressing%20F8%20will%20step%20through%20(or%20run)%20the%20code%20one%20line%20at%20a%20time%2C%20so%20you%20can%20see%20what's%20going%20on.%20If%20the%20code%20throws%20an%20error%20you'll%20be%20able%20to%20see%20where.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFor%20remote%20access%2C%20I%20don't%20really%20have%20any%20way%20to%20do%20that%2C%20but%20you%20can%20always%20upload%20a%20sanitized%20(no%20sensitive%20private%2Fpersonal%20information)%20copy%20of%20your%20workbook%20to%20OneDrive%20and%20share%20a%20link%20here.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892061%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892061%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BI%20sent%20you%20the%20code%20that%20came%20up.%26nbsp%3B%20Was%20that%20not%20what%20you%20needed%3F%26nbsp%3B%20If%20not%20can%20you%20specify%20more%20detailed%20instructions%20because%20I%20tried%20your%20last%20set%20(after%20i%20sent%20you%20the%20code%20I%20had)%20and%20nothing%20different%20came%20up%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892108%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892108%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BSo%20what%20happened%20when%20you%20stepped%20through%20the%20code%3F%20Did%20it%20actually%20send%20an%20email%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUnfortunately%2C%20I've%20got%20meetings%20all%20afternoon%2C%20so%20I%20can't%20test%20it%20until%20later.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892118%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892118%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BNot%20sure%20what%20u%20mean%20by%20saying%20%22stepped%20thru%20the%20code%22.%26nbsp%3B%20I%20sent%20you%20the%20code%20that%20came%20up.%26nbsp%3B%20When%20i%20click%20%22send%20email%22%20from%20the%20button%20the%20excel%20macro%2C%20basically%20nothing%20happens%20(email%20is%20not%20sent%20out).%26nbsp%3B%20Pls%20advise%20when%20you%20have%20time%20or%20what%20u%20see%20in%20the%20code%20I%20sent.%26nbsp%3B%20Thx%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892277%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892277%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BStepping%20through%20the%20code%20with%20F8%20executes%20the%20code%20one%20line%20at%20a%20time.%20This%20lets%20you%20test%20each%20line%20to%20see%20if%20it's%20executing%20properly.%20When%20you%20just%20click%20the%20button%20and%20it%20doesn't%20do%20anything%20doesn't%20tell%20you%20what's%20going%20on%20under%20the%20hood.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20step%20through%20the%20code%2C%20press%20Alt%2BF11%20to%20open%20the%20VB%20Editor.%20Find%20the%20module%20with%20your%20code%2C%20then%20place%20your%20cursor%20anywhere%20within%20the%20procedure.%20Press%20F8%2C%20and%20Excel%20will%20highlight%20the%20first%20executable%20row%20in%20yellow.%20Keep%20pressing%20F8%20until%20you%20complete%20the%20procedure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFYI%20-%20I%20tweaked%20your%20code%20with%20my%20email%20address%20and%20it%20executes%20just%20fine%2C%20so%20you%20might%20want%20to%20check%20your%20button%20and%20make%20sure%20the%20macro%20is%20actually%20assigned%20to%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893292%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893292%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3Bthere%20are%204%20different%20modules%20that%20come%20up%20when%20i%20do%20the%20F11%20function.%26nbsp%3B%20When%20I%20started%20clicking%20F8%2C%20on%20the%20third%20click%20I%20got%20an%20error%20message%20that%20said%20%22run%20time%20error%209%2C%20subscript%20out%20of%20range%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Epls%20advise.%26nbsp%3B%20Not%20really%20sure%20what%20else%20to%20do%20here%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893583%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893583%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BOK%2C%20first%2C%20are%20you%20in%20the%20mail%20routine%3F%20Second%2C%20which%20line%20of%20code%20throws%20the%20error%20(it'll%20be%20highlighted%20in%20yellow)%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893626%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893626%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BWhen%20you%20say%20%22are%20you%20in%20the%20mail%20routine%22%20i%20assume%20you%20mean%20am%20I%20using%20the%20alt-f11%20combo%20while%20in%20the%20excel%20file%20that%20has%20the%20issue%20-%20answer%20is%20yes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENothing%20comes%20up%20when%20i%20hit%20f8%20and%20try%20to%20identify%20the%20error%20because%20before%20i%20can%20keep%20hitting%20that%20multiple%20times%20to%20locate%20the%20error%2C%20i%20get%20the%20error%20message%20i%20wrote%20in%20my%20previous%20post.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893718%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893718%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BOK%2C%20I'd%20imagine%20your%20code%20is%20falling%20apart%20on%20this%20line%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESheets(Array(%22POSIT%22%2C%20%22RECAP%22%2C%20%22-P%26amp%3BL-%22%2C%20%22MTD%22)).Copy%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhich%20tells%20me%20that%20one%20of%20those%20sheets%20doesn't%20exist%2C%20or%20isn't%20spelled%20the%20same%20way%20as%20it%20is%20in%20the%20code.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893731%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893731%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BMy%20questions%20then%20is%20%22why%20does%20the%20macro%20and%20quick%20button%20work%20perfectly%20fine%20on%20my%20home%20computer%2C%20yet%20not%20on%20my%20work%20one%22%3F%26nbsp%3B%20It's%20the%20same%20exact%20excel%20spreadsheet%20for%20both.%26nbsp%3B%20That%20is%20what%20I'm%20not%20understanding.%26nbsp%3B%20I%20feel%20like%20it%20has%20to%20somehow%20be%20the%20link%20between%20the%20macro%20on%20excel%20and%20the%20setup%20of%20my%20microsoft%20e-mail%20or%20the%20like.%26nbsp%3B%20Interested%20in%20your%20thoughts%20here.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893821%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893821%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BUnfortunately%2C%20I%20have%20no%20idea.%20Like%20I%20said%2C%20the%20code%20works%20fine%20for%20me%20when%20I%20adjust%20it%20for%20my%20email%20address.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20did%20notice%20one%20thing%20when%20I%20ran%20it%20that%20Outlook%20throws%20a%20redemption%20notification%20(it's%20the%20dialog%20that%20says%20an%20app%20is%20trying%20to%20send%20a%20mail).%20You%20can%20get%20around%20that%20with%20this%3A%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fdimastr.com%2Fredemption%2Fhome.htm%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fdimastr.com%2Fredemption%2Fhome.htm%2C%26nbsp%3B%3C%2FA%3Ealthough%20that%20generally%20doesn't%20cause%20an%20error%2C%20just%20a%20pause%20before%20the%20mail%20sends.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUltimately%2C%20you'll%20need%20to%20figure%20out%20which%20line%20of%20code%20is%20throwing%20the%20subscript%20out%20of%20range%20error.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-893823%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-893823%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BHow%20do%20I%20figure%20out%20what%20is%20causing%20that%20subscript%20error%20when%20I%20can't%20hit%20F8%20more%20than%203%20times%20to%20find%20the%20problematic%20code%20(before%20I%20get%20the%20error%20message)%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-894018%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-894018%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BThe%20error%20message%20is%20what's%20important.%20When%20it%20pops%20up%2C%20choose%20the%20Debug%20option.%20The%20message%20will%20disappear%2C%20and%20the%20offending%20line%20of%20code%20will%20be%20highlighted%20in%20yellow.%20That's%20what%20you%20need%20to%20fix%20(presuming%20it's%20the%20only%20error).%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-894027%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-894027%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10827%22%20target%3D%22_blank%22%3E%40Smitty%20Smith%3C%2FA%3E%26nbsp%3BThis%20is%20the%20line%20that%20pops%20up%20yellow%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESheets(%22ARB%22).Select...I%20clicked%20debug%20and%20I%20guess%20it's%20in%20process%3F%26nbsp%3B%20That%20take%20a%20while%3F%26nbsp%3B%20or%20should%20i%20try%20something%20else%20afterwards%20now%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-894056%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20issue%20with%20email%20connectivity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-894056%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F418136%22%20target%3D%22_blank%22%3E%40unhappyuser%3C%2FA%3E%26nbsp%3BA%20subscript%20out%20of%20range%20error%20on%20that%20line%20indicates%20that%201)%20you%20don't%20have%20a%20sheet%20named%20ARB%2C%20and%20Excel%20throws%20an%20error%20because%20it%20can't%20find%20it%2C%20or%202)%20you%20have%20a%20sheet%20named%20something%20similar%20to%20%22ARB%22%2C%20but%20not%20exactly%2C%20so%20again%2C%20Excel%20can't%20find%20it.%20Try%20putting%20an%20apostrophe%20in%20front%20of%20that%20line%20of%20code%2C%20which%20will%20turn%20it%20into%20a%20comment%20that%20VBA%20will%20ignore%2C%20and%20try%20stepping%20through%20again.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJust%20a%20heads%20up%20that%20it's%20generally%20not%20necessary%20to%20select%20sheets%20in%20code.%20But%20that%20line%20of%20code%20isn't%20in%20what%20you%20originally%20posted%2C%20so%20I'm%20not%20sure%20what's%20going%20on.%3C%2FP%3E%3C%2FLINGO-BODY%3E
unhappyuser
Occasional Contributor

so i have a macro that i send each day for work - it's on my excel spreadsheet. it's supposed to automatically send my pnl sheet to the designated people on email. it works fine on my home laptop, but here on this computer it doesn't work for some reason

not sure if it's because there is an issue that the email is not linked somehow? or that maybe my antivirus is blocking - 

21 Replies

@unhappyuser Unfortunately, that's not much to go on...Does the code error? If so, what's the error? If it doesn't throw an error, but doesn't do anything else either, then I'd suggest stepping through the code with F8. It will help point you in the right direction.

 

It'll also help if you posted the code.

@Smitty Smith Can you explain the "step through the code with F8"?  I'm not a techie, so not sure what that means.  When I click "send PNL", nothing happens.  I then tried to click F8 as you mentioned, but nothing happened so I'm assuming there is something else I need to do here to gather the code.  Pls advise.  Thanks

 

 

@unhappyuser I'd first check and make sure your macro is assigned to the "Send PNL" button. If that doesn't fix it, then press Alt+F11 to open the VB Editor, then find the module with your mail routine in it. Once there, pressing F8 will step through the code one line at a time, so you can see what's going on. If the code throws an error you'll be able to see where.

 

FYI - Pressing F8 in Excel toggles Extend Selection. I point that out because it can drive you nuts if you turn it on and don't realize it.

@Smitty Smith 

 

Sub sendpnlemailandprint()

' sendemailtopositions Macro
' Macro recorded 3/19/2010 by d.namdar
' Mail_SheetsArray()

Dim strDate As String
Dim strDate2 As String
ActiveWorkbook.Save
Sheets(Array("POSIT", "RECAP", "-P&L-", "MTD")).Copy
strDate = Format(Date, "mm-dd-yy") & " " & Format(Time, "h-mm-ss")
strDate2 = Format(Date, "mm-dd-yy")
ActiveWorkbook.SaveAs "Todd PnL " & ThisWorkbook.Name _
& " " & strDate2 & ".xlsx"
ActiveWorkbook.SendMail Array (I removed the actual email addresses here fyi)
"Pierce P/L " & strDate2
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False

 

Let me know what you think.  And do you work for microsoft?  

@unhappyuser Your code looks fine to me. What happened when you stepped through it?

 

And yes, I do work for Microsoft. I manage all the support content for Excel.

@Smitty Smith Not sure what you mean when u say "stepped thru it."  Basically i click on it and the email should be sent, but just nothing happens.  The process works totally fine on my home laptop, but not at my work setup.  Let me know.

 

Also, do you remote in ever to solve problems (or does someone on your team)?  Guessing it would be a lot easier for a tech to make sense of all this and fix.  

@unhappyuser Step though: press Alt+F11 to open the VB Editor, then find the module with your mail routine in it. Once there, pressing F8 will step through (or run) the code one line at a time, so you can see what's going on. If the code throws an error you'll be able to see where.

 

For remote access, I don't really have any way to do that, but you can always upload a sanitized (no sensitive private/personal information) copy of your workbook to OneDrive and share a link here.

@Smitty Smith I sent you the code that came up.  Was that not what you needed?  If not can you specify more detailed instructions because I tried your last set (after i sent you the code I had) and nothing different came up

@unhappyuser So what happened when you stepped through the code? Did it actually send an email?

 

Unfortunately, I've got meetings all afternoon, so I can't test it until later.

@Smitty Smith Not sure what u mean by saying "stepped thru the code".  I sent you the code that came up.  When i click "send email" from the button the excel macro, basically nothing happens (email is not sent out).  Pls advise when you have time or what u see in the code I sent.  Thx

@unhappyuser Stepping through the code with F8 executes the code one line at a time. This lets you test each line to see if it's executing properly. When you just click the button and it doesn't do anything doesn't tell you what's going on under the hood.

 

To step through the code, press Alt+F11 to open the VB Editor. Find the module with your code, then place your cursor anywhere within the procedure. Press F8, and Excel will highlight the first executable row in yellow. Keep pressing F8 until you complete the procedure.

 

FYI - I tweaked your code with my email address and it executes just fine, so you might want to check your button and make sure the macro is actually assigned to it.

@Smitty Smith there are 4 different modules that come up when i do the F11 function.  When I started clicking F8, on the third click I got an error message that said "run time error 9, subscript out of range"

 

pls advise.  Not really sure what else to do here

@unhappyuser OK, first, are you in the mail routine? Second, which line of code throws the error (it'll be highlighted in yellow)?

@Smitty Smith When you say "are you in the mail routine" i assume you mean am I using the alt-f11 combo while in the excel file that has the issue - answer is yes.

 

Nothing comes up when i hit f8 and try to identify the error because before i can keep hitting that multiple times to locate the error, i get the error message i wrote in my previous post.

@unhappyuser OK, I'd imagine your code is falling apart on this line:

 

Sheets(Array("POSIT", "RECAP", "-P&L-", "MTD")).Copy

 

Which tells me that one of those sheets doesn't exist, or isn't spelled the same way as it is in the code.

@Smitty Smith My questions then is "why does the macro and quick button work perfectly fine on my home computer, yet not on my work one"?  It's the same exact excel spreadsheet for both.  That is what I'm not understanding.  I feel like it has to somehow be the link between the macro on excel and the setup of my microsoft e-mail or the like.  Interested in your thoughts here.  

@unhappyuser Unfortunately, I have no idea. Like I said, the code works fine for me when I adjust it for my email address.

 

I did notice one thing when I ran it that Outlook throws a redemption notification (it's the dialog that says an app is trying to send a mail). You can get around that with this: http://dimastr.com/redemption/home.htm, although that generally doesn't cause an error, just a pause before the mail sends.

 

Ultimately, you'll need to figure out which line of code is throwing the subscript out of range error. 

@Smitty Smith How do I figure out what is causing that subscript error when I can't hit F8 more than 3 times to find the problematic code (before I get the error message)?  

@unhappyuser The error message is what's important. When it pops up, choose the Debug option. The message will disappear, and the offending line of code will be highlighted in yellow. That's what you need to fix (presuming it's the only error). 

@Smitty Smith This is the line that pops up yellow 

 

Sheets("ARB").Select...I clicked debug and I guess it's in process?  That take a while?  or should i try something else afterwards now?

@unhappyuser A subscript out of range error on that line indicates that 1) you don't have a sheet named ARB, and Excel throws an error because it can't find it, or 2) you have a sheet named something similar to "ARB", but not exactly, so again, Excel can't find it. Try putting an apostrophe in front of that line of code, which will turn it into a comment that VBA will ignore, and try stepping through again.

 

Just a heads up that it's generally not necessary to select sheets in code. But that line of code isn't in what you originally posted, so I'm not sure what's going on.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies