Accessing the Globals.ThisAddIn.Application

Add-in Express™ Support Service
That's what is more important than anything else

Accessing the Globals.ThisAddIn.Application
 
learningaddinexpress




Posts: 16
Joined: 2020-03-19
I think I should be done with my final request :D

I launch a form from a ribbon button. I could address the application xlApp earlier with Globals.ThisAddIn.Application. How do I do that in Add-in Express?



Imports Excel = Microsoft.Office.Interop.Excel

Public Class FrmSample
    Dim xlApp As Excel.Application = Nothing

    Private Sub FrmSample_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        xlApp = Globals.ThisAddIn.Application
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim rngA As Excel.Range = Nothing

        Try
            rngA = xlApp.InputBox(Prompt:="Your message", Title:="Select Range", Type:=8)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class
Posted 19 Mar, 2020 03:47:22 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Mike,

It looks like the idea of "final request" haunts people. :)

Replace Globals.ThisAddIn.Application with MyAddin28.CurrentInstance.ExcelApp.

Feel free to ask me if you run into an issue, have any question or need more information.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Mar, 2020 04:36:12 Top
learningaddinexpress




Posts: 16
Joined: 2020-03-19
It looks like the idea of "final request" haunts people. :)


Please don't say that! :D

I am trying to solve as much as I can without troubling you guys. It is really a pain porting an existing Add-in to Add-In Express (no fault of yours). I am sure once I get the hang of it, it will be fun! I am already enjoying it!
Posted 19 Mar, 2020 04:41:56 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Asking questions may save your time. Besides, this may help you avoid common mistakes and thus save your time again.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Mar, 2020 04:48:45 Top
learningaddinexpress




Posts: 16
Joined: 2020-03-19
Understood!
Posted 19 Mar, 2020 04:51:52 Top