Jump to content
Sign in to follow this  
nlgma

Quick Excel question

Recommended Posts

nlgma

I need to know how to make a not visible excel file visible after the file has already been opened using $oExcel = _ExcelBookOpen($Excel,0) NOT VISIBLE ?

Syntax.........: $oExcel = _ExcelBookOpen($sFilePath, $fVisible = 1, $fReadOnly = False, $sPassword = "", $sWritePassword = "")
Parameters ....: $sFilePath - Path and filename of the file to be opened
                  $fVisible - Flag, whether to show or hide the workbook (0=not visible, 1=visible) (default=1)
                  $fReadOnly - Flag, whether to open the workbook as read-only (True or False) (default=False)
                  $sPassword - The password that was used to read-protect the workbook, if any (default is none)
                  $sWritePassword - The password that was used to write-protect the workbook, if any (default is none)

Share this post


Link to post
Share on other sites
nlgma

Do you mean something like FileSetAtrrib? Look at it in the helpfile, I'm not exactly sure if that's what you're talking about.

FileSetAttrib - Sets the attributes of one or more files. I just need to make a not visible window visible. I can see the process running, just can't see the window.

Edited by nlgma

Share this post


Link to post
Share on other sites
nlgma

Blow is an idea of what I'm trying to do.

#include <GuiButton.au3>
#include <GUIConstants.au3>
#include <Excel.au3>

$Test = GUICreate("Show / Hide", 305, 115, 320, 300)
$Button0 = GUICtrlCreateButton("Open", 25, 70, 130, 30)
$Button1 = GUICtrlCreateButton("Show", 155, 70, 130, 30)
$Button2 = GUICtrlCreateButton("Hide", 155, 70, 130, 30)
GUICtrlSetState($Button2 , $gui_Hide)
$Input1 = GUICtrlCreateInput("", 25, 40, 210, 20)
$Button3 = GUICtrlCreateButton("", 240, 25, 30,30, $BS_ICON)
_GUICtrlButton_SetImage($Button3, "shell32.dll", 55, True)
$Label1 = GUICtrlCreateLabel("Enter in the path to your excel file.", 25, 15, 215, 20)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button3
            $var = FileOpenDialog("Choose a file.",@ScriptDir&"", "Excel (*.csv)|ALL (*.*)")
            GUICtrlSetData($Input1,$var)
        Case $Button0
            $oExcel = _ExcelBookOpen(GUICtrlRead($Input1),0); 0 = NOT Visible | 1 = Visible
        Case $Button1
            
       ;I need it to show the Excel window.
            
            GUICtrlSetState($Button1 , $gui_Hide)
            GUICtrlSetState($Button2 , $gui_Show)
        Case $Button2
            
       ;I need it to hide the Excel window.
            
            GUICtrlSetState($Button1 , $gui_Show)
            GUICtrlSetState($Button2 , $gui_Hide)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
PsaltyDS

I think all you really want is:

$oExcel.Visible = 1; Visible
$oExcel.Visible = 0; Not visible

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
nlgma

I think all you really want is:

$oExcel.Visible = 1; Visible
$oExcel.Visible = 0; Not visible

:mellow:

Thank you ... thank you ... thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×