Jump to content

Naming Excel Sheet


Recommended Posts

@water
If I have to use again the workbook that I've created with _Excel_BookNew(), it returns the error "Variable must be of type object".
Instead, If I use the _Excel_BookNew() first, and then I open it with _Excel_BookOpen(), it works smoothly ( like I wrote in the post #16 ) :)
I don't know why, but I tried before writing here :) 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Maybe the same problem that the object returned by _Excel_BookNew gets lost because the variable holding the object has a scope of Local?
Or you re-use the variable somewhere in your script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$DealerPicklist = IniRead(@ScriptDir & "\config.ini", "data", "Dealer", "")
    Local $sNewPickFolderPath = @DesktopDir & "\PickListCasa" ;folder to copy existing diretories while copying to desktop
    If Not FileExists($sNewPickFolderPath) Then DirCreate($sNewPickFolderPath)

                
        $oExcel = _Excel_Open(False) ; invisible
        ;$oExcel = _Excel_Open(True) ;visible
        $datawb = _Excel_BookOpen($oExcel, $DealerPicklist, False, "", "Casa321")
        If @error = 1 Then
            MsgBox(0, "Error!", "Unable to Create the Excel Object!, please reboot")
            Exit
        ElseIf @error = 2 Then
            MsgBox(0, "Error!", "File does not exist!")
            Exit
        EndIf
        $datawb.worksheets("StoreCasa").Select
        

                Sleep(15)
        $savewb = $sNewPickFolderPath & "\" & $checknum & "CasaPickList.xlsx"
        _Excel_BookSaveAs($datawb, $savewb, $xlWorkbookDefault, True, "", "Casa321")
        _Excel_BookClose($datawb, True)
        _Excel_Close($oExcel, True)

Can someone assist or give me an idea how to resolve.

the current code works the spreadsheet stay hidden, ONLy if there is no spreadsheet open at the desktop. However if there is a spreadsheet open at the desktop, it will hide that one, however my hidden spreadsheet will now become visible.

Link to comment
Share on other sites

Set parameter $bForceNew in _Excel_Open to True and the UDF will start an independant new instance which doesn't interfere with an already running instance of Excel.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:) 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

×
×
  • Create New...