+ Reply to Thread
Results 1 to 4 of 4

Programming Outside of Excel Not Recognizing Excel.Visible

  1. #1
    Registered User
    Join Date
    05-15-2007
    Posts
    16

    Programming Outside of Excel Not Recognizing Excel.Visible

    Working with a VBScript that uses the GetObject method to open a specific workbook:

    Please Login or Register  to view this content.
    I am not able to set objExcel.Visible = True I receive an unable to select range error when I try to select the range I want in the sheet. The other folks that use this same sheet in a shared network folder, shared workbook get confused with the VBScript error when they forget to open the file first and run the script. Building an event that detects if the file is open and CreateObject if it isn't would be a better solution, but I have not been able to get my script to do that successfully yet.

    Is there something that I can add to the GetObject method to force it to become visible as the file opens if it wasn't already?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello ShannonLarson,

    In your code GetObject may is not returning an object instance of Excel, but an instance of the workbook. The workbook has no visible property. That's why setting objExcel.Visible fails.

    Are you trying to open the workbook minimized on the task bar?

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    05-15-2007
    Posts
    16
    What I need it to do is come into maximized view when the script opens the workbook and fully visible.

    In the case of the workbook, there is a userform that executes upon opening that displays a listbox of user names to be selected and apply to the sheet. Could that be what's preventing the workbook's visibility from occurring? Can that be executed independently of the workbook so as not to interfere with my external script?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello ShannonLarson,

    To open the workbook, simply use this code...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1