Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2004
    Posts
    32

    Unanswered: How to show Excel

    I am writing a bit of code to put data into an excel spreadsheet, save it (under a different name) thane email it off to another department (they only accept requests in a specific format. Part of the code is:

    Dim myExcelApp As New Excel.Application
    Dim myWrkbk As New Excel.Workbook
    Dim mySheet As New Excel.Worksheet

    myPath = "\\drv\alias$\users\Request_Template.xls"
    Set myWrkbk = myExcelApp.Workbooks.Open(myPath, True)
    Set mySheet = myWrkbk.Sheets("Version 5")
    mySheet.Visible = xlSheetHidden
    mySheet.Visible = xlSheetVisible
    myExcelApp.DisplayFullScreen = True

    My problem is that whatever I do I can't get excel to appear on screen. I'm probably missing something really obvious. Anyone have any ideas on what I should do with Excel?

  2. #2
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by DerrickM
    I am writing a bit of code to put data into an excel spreadsheet, save it (under a different name) thane email it off to another department (they only accept requests in a specific format. Part of the code is:

    Dim myExcelApp As New Excel.Application
    Dim myWrkbk As New Excel.Workbook
    Dim mySheet As New Excel.Worksheet

    myPath = "\\drv\alias$\users\Request_Template.xls"
    Set myWrkbk = myExcelApp.Workbooks.Open(myPath, True)
    Set mySheet = myWrkbk.Sheets("Version 5")
    mySheet.Visible = xlSheetHidden
    mySheet.Visible = xlSheetVisible
    myExcelApp.DisplayFullScreen = True

    My problem is that whatever I do I can't get excel to appear on screen. I'm probably missing something really obvious. Anyone have any ideas on what I should do with Excel?
    Hi,
    Though I don't have an answer, I did happen to notice something, and it may mean nothing to hamper the process, but in your code you have:

    mySheet.Visible = xlSheetHidden
    mySheet.Visible = xlSheetVisible


    Why set it to Hidden and then to Visible? Just trying to get a bit of learning in myself.
    BUD

  3. #3
    Join Date
    Nov 2004
    Posts
    32
    Good point Bud - I had set to it visible; that didn't work. I found that idea on a web site (using google), but it made no difference.

    The frustrating thing is that the rest of the code works OK. I populate the spreadsheet then have to open it seperately to print off and check before emailing it.

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    Did you try

    myExcelApp.visible=true
    Roy-Vidar

  5. #5
    Join Date
    Nov 2004
    Posts
    32
    Thanks Roy that sort of works. I also added the line:

    myExcelApp.DisplayFullScreen = True

    otherwise the thing just opens in a small window and freezes.


  6. #6
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    another piece of code you might like to try is

    myExcelApp.UserControl

Posting Permissions

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