Results 1 to 2 of 2

Thread: [RESOLVED] [2005] 2 Excel questions

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Resolved [RESOLVED] [2005] 2 Excel questions

    I was advised to write an alias at the top of my form when Importing Excel due to a conflict I was having.

    VB Code:
    1. Imports Excel = Microsoft.Office.Interop.Excel

    I cannot find the Interop bit. It only offers .Core
    I've searched and cannot figure out what I'm doing wrong. How do I get that option? I've imported the Office and Excel COMs. I'm using Office 2003.

    Q. 2. On a form load I create and excel workbook with 25 worksheets which works fine. Should this code however not completely close all Excel processes? When I look at task manager there is still an excel process. I created this on a new app with no other Excel references etc... I closed all excel processes from the task manager just to be sure and tried the code again. It creates the process and it stays there even after closing everything.
    I'm having problems with a program and can't rule out that the excel process may be causing it. Don't see any reason why it should but just want to be sure so would like to know that it's completely gone from memory/whatever. (this code works fine btw).

    VB Code:
    1. Imports Excel
    2.  
    3.  Dim moApp As New Excel.Application
    4.  moApp = DirectCast(CreateObject("Excel.Application"), Excel.Application)  'Create Excel Object
    5.                 moApp.Visible = False
    6.                 '---------------------------------------------------------------------------------------------
    7.                 '-------DECLARE THE IMAGE AND VIDEO WORKBOOKS------------------------------------------------------------'
    8.                 Dim oVidWB As Excel.Workbook '= moApp.Workbooks.Open(Data_Output & file_Name & "\Vidworkbook1.xls")   'Open the workbook
    9.                 Dim osht1 As Excel.Worksheet
    10.                 oVidWB = moApp.Workbooks.Add
    11.                 For T As Integer = 24 To 0 Step -1
    12.                     osht1 = oVidWB.Sheets.Add()
    13.                     osht1.Name = Cases(T).ToString
    14.                     osht1 = Nothing
    15.                 Next
    16.        
    17.                 oVidWB.SaveAs(Data_Output & file_Name & filename(r))
    18.                 oVidWB.Close(False)
    19.                 oVidWB = Nothing
    20.                 moApp.Quit()
    21.                 moApp = Nothing
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  2. #2

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] 2 Excel questions

    Forget about Q2, I've sorted it out.

    Still looking for answer to Q1 though if anyone knows. Ta.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width