Creating Outlook application from Excel generates type mismatch error









up vote
1
down vote

favorite












I am trying to create an Outlook email using an Outlook template.



On the Set obApp = Outlook.Application line, I am receiving the error:




Error: 13 Type Mismatch




I seem to be using the same syntax used in other posts on this site on the subject.



I also tried Set obApp = CreateObject("Outlook.Applciation") with the same result.



I have OLE Automation, Microsoft Outlook 16.0 Object Library, Microsoft Office 16.0 Library, and Microsoft Excel 16.0 Object Library, and visual Basic for Applications all checked in Tools-> References.



Sub CreateEmailfromTemplate()
Dim obApp As Application
Dim NewMail As Outlook.MailItem

Set obApp = Outlook.Application 'THE PROBLEM IS HERE
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub









share|improve this question























  • If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
    – 0m3r
    Nov 12 at 5:26














up vote
1
down vote

favorite












I am trying to create an Outlook email using an Outlook template.



On the Set obApp = Outlook.Application line, I am receiving the error:




Error: 13 Type Mismatch




I seem to be using the same syntax used in other posts on this site on the subject.



I also tried Set obApp = CreateObject("Outlook.Applciation") with the same result.



I have OLE Automation, Microsoft Outlook 16.0 Object Library, Microsoft Office 16.0 Library, and Microsoft Excel 16.0 Object Library, and visual Basic for Applications all checked in Tools-> References.



Sub CreateEmailfromTemplate()
Dim obApp As Application
Dim NewMail As Outlook.MailItem

Set obApp = Outlook.Application 'THE PROBLEM IS HERE
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub









share|improve this question























  • If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
    – 0m3r
    Nov 12 at 5:26












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to create an Outlook email using an Outlook template.



On the Set obApp = Outlook.Application line, I am receiving the error:




Error: 13 Type Mismatch




I seem to be using the same syntax used in other posts on this site on the subject.



I also tried Set obApp = CreateObject("Outlook.Applciation") with the same result.



I have OLE Automation, Microsoft Outlook 16.0 Object Library, Microsoft Office 16.0 Library, and Microsoft Excel 16.0 Object Library, and visual Basic for Applications all checked in Tools-> References.



Sub CreateEmailfromTemplate()
Dim obApp As Application
Dim NewMail As Outlook.MailItem

Set obApp = Outlook.Application 'THE PROBLEM IS HERE
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub









share|improve this question















I am trying to create an Outlook email using an Outlook template.



On the Set obApp = Outlook.Application line, I am receiving the error:




Error: 13 Type Mismatch




I seem to be using the same syntax used in other posts on this site on the subject.



I also tried Set obApp = CreateObject("Outlook.Applciation") with the same result.



I have OLE Automation, Microsoft Outlook 16.0 Object Library, Microsoft Office 16.0 Library, and Microsoft Excel 16.0 Object Library, and visual Basic for Applications all checked in Tools-> References.



Sub CreateEmailfromTemplate()
Dim obApp As Application
Dim NewMail As Outlook.MailItem

Set obApp = Outlook.Application 'THE PROBLEM IS HERE
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub






excel vba outlook outlook-vba type-mismatch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 19:59









K.Dᴀᴠɪs

6,056112140




6,056112140










asked Nov 11 at 6:51









OrangeOwner

128




128











  • If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
    – 0m3r
    Nov 12 at 5:26
















  • If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
    – 0m3r
    Nov 12 at 5:26















If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
– 0m3r
Nov 12 at 5:26




If the code is in Outlook then no need to set application, simply use ‘Application.CreateItem’
– 0m3r
Nov 12 at 5:26












1 Answer
1






active

oldest

votes

















up vote
2
down vote













You have two options to choose from:



Option 1: Early Binding



In order to use early binding, you need to set a reference to:



Microsoft Outlook ##.# Object Library


Which can be done in the VBE > Tools > References. I assume this is the method you are preferring due to the way you have already declared your variables.



The issue in your code using this method is that in the statement Dim xxxx As Application, As Application is referring to Excel's Object Model. You need to specify you are wanting to use Outlook.



Sub CreateEmailfromTemplate()

Dim obApp As New Outlook.Application '<-- Notice Change
Dim NewMail As Outlook.MailItem

Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Option 2: Late Binding



You will not need to set a reference in this method, but Outlook's types and constants will not be available at compile time. The compiler will obtain these during runtime.



Sub CreateEmailfromTemplate()

Dim obApp As Object
Dim NewMail As Object

Set obApp = CreateObject("Outlook.Application")
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Notice in this method Outlook's objects were declared as type Object.






share|improve this answer






















  • Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
    – Greedo
    Nov 11 at 9:56







  • 1




    @Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
    – K.Dᴀᴠɪs
    Nov 11 at 9:58











  • Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
    – Greedo
    Nov 11 at 10:09











  • Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
    – K.Dᴀᴠɪs
    Nov 11 at 10:24











  • Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
    – Greedo
    Nov 11 at 10:38











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246493%2fcreating-outlook-application-from-excel-generates-type-mismatch-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote













You have two options to choose from:



Option 1: Early Binding



In order to use early binding, you need to set a reference to:



Microsoft Outlook ##.# Object Library


Which can be done in the VBE > Tools > References. I assume this is the method you are preferring due to the way you have already declared your variables.



The issue in your code using this method is that in the statement Dim xxxx As Application, As Application is referring to Excel's Object Model. You need to specify you are wanting to use Outlook.



Sub CreateEmailfromTemplate()

Dim obApp As New Outlook.Application '<-- Notice Change
Dim NewMail As Outlook.MailItem

Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Option 2: Late Binding



You will not need to set a reference in this method, but Outlook's types and constants will not be available at compile time. The compiler will obtain these during runtime.



Sub CreateEmailfromTemplate()

Dim obApp As Object
Dim NewMail As Object

Set obApp = CreateObject("Outlook.Application")
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Notice in this method Outlook's objects were declared as type Object.






share|improve this answer






















  • Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
    – Greedo
    Nov 11 at 9:56







  • 1




    @Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
    – K.Dᴀᴠɪs
    Nov 11 at 9:58











  • Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
    – Greedo
    Nov 11 at 10:09











  • Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
    – K.Dᴀᴠɪs
    Nov 11 at 10:24











  • Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
    – Greedo
    Nov 11 at 10:38















up vote
2
down vote













You have two options to choose from:



Option 1: Early Binding



In order to use early binding, you need to set a reference to:



Microsoft Outlook ##.# Object Library


Which can be done in the VBE > Tools > References. I assume this is the method you are preferring due to the way you have already declared your variables.



The issue in your code using this method is that in the statement Dim xxxx As Application, As Application is referring to Excel's Object Model. You need to specify you are wanting to use Outlook.



Sub CreateEmailfromTemplate()

Dim obApp As New Outlook.Application '<-- Notice Change
Dim NewMail As Outlook.MailItem

Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Option 2: Late Binding



You will not need to set a reference in this method, but Outlook's types and constants will not be available at compile time. The compiler will obtain these during runtime.



Sub CreateEmailfromTemplate()

Dim obApp As Object
Dim NewMail As Object

Set obApp = CreateObject("Outlook.Application")
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Notice in this method Outlook's objects were declared as type Object.






share|improve this answer






















  • Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
    – Greedo
    Nov 11 at 9:56







  • 1




    @Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
    – K.Dᴀᴠɪs
    Nov 11 at 9:58











  • Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
    – Greedo
    Nov 11 at 10:09











  • Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
    – K.Dᴀᴠɪs
    Nov 11 at 10:24











  • Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
    – Greedo
    Nov 11 at 10:38













up vote
2
down vote










up vote
2
down vote









You have two options to choose from:



Option 1: Early Binding



In order to use early binding, you need to set a reference to:



Microsoft Outlook ##.# Object Library


Which can be done in the VBE > Tools > References. I assume this is the method you are preferring due to the way you have already declared your variables.



The issue in your code using this method is that in the statement Dim xxxx As Application, As Application is referring to Excel's Object Model. You need to specify you are wanting to use Outlook.



Sub CreateEmailfromTemplate()

Dim obApp As New Outlook.Application '<-- Notice Change
Dim NewMail As Outlook.MailItem

Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Option 2: Late Binding



You will not need to set a reference in this method, but Outlook's types and constants will not be available at compile time. The compiler will obtain these during runtime.



Sub CreateEmailfromTemplate()

Dim obApp As Object
Dim NewMail As Object

Set obApp = CreateObject("Outlook.Application")
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Notice in this method Outlook's objects were declared as type Object.






share|improve this answer














You have two options to choose from:



Option 1: Early Binding



In order to use early binding, you need to set a reference to:



Microsoft Outlook ##.# Object Library


Which can be done in the VBE > Tools > References. I assume this is the method you are preferring due to the way you have already declared your variables.



The issue in your code using this method is that in the statement Dim xxxx As Application, As Application is referring to Excel's Object Model. You need to specify you are wanting to use Outlook.



Sub CreateEmailfromTemplate()

Dim obApp As New Outlook.Application '<-- Notice Change
Dim NewMail As Outlook.MailItem

Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Option 2: Late Binding



You will not need to set a reference in this method, but Outlook's types and constants will not be available at compile time. The compiler will obtain these during runtime.



Sub CreateEmailfromTemplate()

Dim obApp As Object
Dim NewMail As Object

Set obApp = CreateObject("Outlook.Application")
Set NewMail = obApp.CreateItemFromTemplate("F:Folder1AutomationEmailTemplatesTEST TEST.oft")
NewMail.Display

End Sub


Notice in this method Outlook's objects were declared as type Object.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 at 1:58

























answered Nov 11 at 9:14









K.Dᴀᴠɪs

6,056112140




6,056112140











  • Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
    – Greedo
    Nov 11 at 9:56







  • 1




    @Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
    – K.Dᴀᴠɪs
    Nov 11 at 9:58











  • Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
    – Greedo
    Nov 11 at 10:09











  • Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
    – K.Dᴀᴠɪs
    Nov 11 at 10:24











  • Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
    – Greedo
    Nov 11 at 10:38

















  • Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
    – Greedo
    Nov 11 at 9:56







  • 1




    @Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
    – K.Dᴀᴠɪs
    Nov 11 at 9:58











  • Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
    – Greedo
    Nov 11 at 10:09











  • Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
    – K.Dᴀᴠɪs
    Nov 11 at 10:24











  • Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
    – Greedo
    Nov 11 at 10:38
















Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
– Greedo
Nov 11 at 9:56





Worth mentioning that in case 1 (early binding) you can use the New syntax instead of GetObject() - i.e Set obApp = New Outlook.Application, which I think feels a bit cleaner
– Greedo
Nov 11 at 9:56





1




1




@Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
– K.Dᴀᴠɪs
Nov 11 at 9:58





@Greedo Depends - I wouldn't necessarily want to create a new object if one is already running. Could you imagine running this code 50 times and having 50 instances open? Sure, you could close the application at the end of the routine, but if the object already exists then why not use it? I probably could have added a check to see if olApp Is Nothing first and then proceed to create a new object.
– K.Dᴀᴠɪs
Nov 11 at 9:58













Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
– Greedo
Nov 11 at 10:09





Ah so true, I mistakenly thought you were using CreateObject()as in the question. There's no early bound /New style equivalent of GetObject() is there? Something like Set obApp = Existing Outlook.Application (which has the minor benefit of being able to dot through the library). And what scope does GetObject() look in - same method and publicly declared variables, or somehow global? Like should a parent method be worried about a child hijacking its instance in this way?
– Greedo
Nov 11 at 10:09













Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
– K.Dᴀᴠɪs
Nov 11 at 10:24





Unfortunately for both early and late binding, there is no equivalent of As New... to GetObject(). And with "...hijacking its instance in this way": I suppose this ultimately boils down to security. Any piece of malware could supposedly gain access to ActiveX/COM programs this way, which would be why it's important to keep your OS and antivirus software up to date, @Greedo.
– K.Dᴀᴠɪs
Nov 11 at 10:24













Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
– Greedo
Nov 11 at 10:38





Oh no, I'm not suggesting anything so nefarious. All I'm wondering is whether under normal circumstances, GetObject has sight of variables that are not in the method's scope. If Sub a has Set a = CreateObject("foo.bar"), can Sub b in a different scope do Set b = GetObject("foo.bar") to get a's object, where Set b = a would give a variable not defined error because of the difference in scope
– Greedo
Nov 11 at 10:38


















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246493%2fcreating-outlook-application-from-excel-generates-type-mismatch-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto