How To Prevent Generation of Multiple Excel Task Pane Instances

I have situation where I am employing a custom task pane in conjunction with a command ribbon:

enter image description here

The task pane is correctly presented when I execute the New or Open buttons, however I need to suppress additional task pain instances when execute the Load button. The load button is just supposed to populate the existing task pane with the header content from a .csv file. This works as expected until I execute the Apply button on the task pane. The code underneath the Apply button generates a new WorkBook, and updates some range content. Now when I execute Load, a new task pane instance is presented and the .CSV header content is loaded into this task pane instead of the original. I need to prevent this 2nd task pane instance from happening. Below is the code executed by the command buttons I refer to:

From the command ribbon:

Private Async Sub btnSubstationLoad_Click(sender As Object, e As RibbonControlEventArgs) Handles btnSubstationLoad.Click

     'Load the csv file so that we can obtain the substation name
     Dim fDialog As New OpenFileDialog
     Dim path As String = Nothing

     Try

          SetTaskPaneOpen()

          If fDialog.ShowDialog() = DialogResult.OK Then
               path = fDialog.FileName
          End If

          Globals.ThisAddIn.StatusBarUpdate("Loading substation data.  Please wait...")

          Globals.ThisAddIn.LoadCSV(path)
          Globals.ThisAddIn.CsvPath = path

          Globals.ThisAddIn.SubstationName = Globals.ThisAddIn.Substations(0).Location
          Globals.ThisAddIn.SubstationAlias = Globals.ThisAddIn.Substations(0).SubAlias
          Globals.ThisAddIn.INN = Globals.ThisAddIn.Substations(0).INN
          Globals.ThisAddIn.LicenceArea = Globals.ThisAddIn.Substations(0).LicenceArea

          'Store the relevant substation alias, INN and Substation Name 
          'populate the substation detail fields with this information
          Globals.ThisAddIn.UcSpenTagManager.txtSubstationName.Text = Globals.ThisAddIn.SubstationName
          Globals.ThisAddIn.UcSpenTagManager.txtLicenceArea.Text = Globals.ThisAddIn.LicenceArea

          If Globals.ThisAddIn.SubstationType = "Secondary" Then
               Globals.ThisAddIn.UcSpenTagManager.rbSecondary.Checked = True
          End If

          If Globals.ThisAddIn.UcSpenTagManager.rbPrimary.Checked Then
               Globals.ThisAddIn.UcSpenTagManager.txtUniqueSubstationId.Text = Globals.ThisAddIn.INN
          Else
               Globals.ThisAddIn.UcSpenTagManager.txtUniqueSubstationId.Text = Globals.ThisAddIn.SubstationAlias
          End If

          'Now set the file loaded flag
          Globals.ThisAddIn.FileLoaded = True

          'Force a delay so that the user can see the change to the status bar
          Await Task.Delay(3000)

          Globals.ThisAddIn.StatusBarUpdate("Ready")

     Catch ex As Exception
          'Now set the file loaded flag
          Globals.ThisAddIn.FileLoaded = False
          Throw
     End Try


End Sub

From the Apply button on the Task Pane:

Private Sub btnApply_Click(sender As Object, e As EventArgs) Handles btnApply.Click

   Dim wb As Workbook
   Dim excelName As Excel.Name
   Dim instanceFolder As String
   Dim instanceTime As String = dtpTimeOfChange.Value.ToString(Globals.ThisAddIn.PatternTimeFormat)
   Dim filePart As String = instanceTime & "_" &
                                      Me.txtChangeReference.Text & "_" &
                                      Me.txtUniqueSubstationId.Text & "_" &
                                      _utl.SafeFileName(Me.txtSubstationName.Text, " ") & "_" &
                                      Me.txtVoltageLevel.Text

   instanceFolder = Me.txtFilePath.Text & "" &
                            instanceTime & "_" &
                            Me.txtChangeReference.Text & "_PIAttributeBatchUpdate" & "" & filePart


   'Generate the tag management folder structure underneath the specified working folder
   'if it doesn't already exist
   '<yyyyMMdd_hhmm>_<SBM Reference>_<busbar number>_<substation name>_<voltage>
   If Not Directory.Exists(instanceFolder) Then
        Directory.CreateDirectory(instanceFolder)
   End If

   Globals.ThisAddIn.InstanceFolder = instanceFolder

   'Now copy the file into place and open in Excel
   File.Copy(Globals.ThisAddIn.TemplatePath, instanceFolder & "" & filePart & ".xlsm")

   'If CSV file has been loaded then clone the file in the instance folder
   If Globals.ThisAddIn.CsvPath <> "" Then
        _utl.CloneFile(Globals.ThisAddIn.CsvPath, instanceFolder & "" & filePart & ".csv")
        'Update the csv path to the new file name so that the correct reference is delivered to the template
        Globals.ThisAddIn.CsvPath = instanceFolder & "" & filePart & ".csv"
   End If

   Dim xlb As Excel.Workbook
   Dim ws As Excel.Worksheet
   Dim rng As Excel.Range

   xlb = Globals.ThisAddIn.Application.Workbooks.Open(instanceFolder & "" & filePart & ".xlsm", True)

   If rbPrimary.Checked Then
        Globals.ThisAddIn.SubstationType = "Primary"
   Else
        Globals.ThisAddIn.SubstationType = "Secondary"
   End If

   rng = _utl.GetNamedRange("TagConvention", xlb.Names)
   rng.Value = Globals.ThisAddIn.TagConvention
   rng = _utl.GetNamedRange("SubstationType", xlb.Names)
   rng.Value = Globals.ThisAddIn.SubstationType

   'add rng updates for ExportPath, BatchPath, Voltage, License Area and 
   rng = _utl.GetNamedRange("CsvPath", xlb.Names)
   rng.Value = Globals.ThisAddIn.CsvPath
   rng = _utl.GetNamedRange("ExportPath", xlb.Names)
   rng.Value = _utl.SplitPath(Globals.ThisAddIn.ExportPath, 0)
   rng = _utl.GetNamedRange("BatchPath", xlb.Names)
   rng.Value = _utl.SplitPath(Globals.ThisAddIn.BatchPath, 0)
   rng = _utl.GetNamedRange("Voltage", xlb.Names)
   rng.Value = Globals.ThisAddIn.Voltage
   rng = _utl.GetNamedRange("LicenseArea", xlb.Names)
   rng.Value = Globals.ThisAddIn.LicenceArea

End Sub

Kind Regards
Paul.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật