| To: | s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | VB function in S-plus |
| From: | Eric yang <yang_eric9@yahoo.com> |
| Date: | Wed, 24 Aug 2005 08:31:53 -0700 (PDT) |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ksraEnMYm/x1YMIS3axToh7F087qwuMGA3pYNGMIxZB4V8kjlZ4Nq7iEBQPZwuthCovfdbAtZYE0m96sRPKlHcfVQgkZaEdu/cP12wYyEnOU3fBrdF+vVpsjeZp0Zw5ME9Ae0anjF2BVVYT2iqaWWHpNtc0yWylnSdPIAZjWtLY= ; |
|
Dear all,
I'm using the function "Excel.Workbook.SaveAs" from the samples\oleauto library. If I use this function at the top level to save an Excel file I am not prompted with a pop-up such as
However, if I use the function within a for-loop or lapply loop then I am prompted with a pop-up such as the one above. Does anyone know how to stop the pop-up if using this function within a loop? Thanks in advance for any help.
Eric
The function is as follows:
# Function to save an Excel workbook under a new file name Excel.Workbook.SaveAs <- function( pExcelApp, pWorkbook, sPathNameToSaveAs ) { bReturn <- T if(missing(pExcelApp)) stop("'pExcelApp' is a required argument and must be of type OLEClient") if(missing(pWorkbook)) stop("'pWorkbook' is a required argument and must be of type OLEClient") if(missing(sPathNameToSaveAs)) stop("'sPathNameToSaveAs' is a required argument and must be of type character") if( !is.character(sPathNameToSaveAs) ) stop("'sPathNameToSaveAs' must be of type character") if( !is.ole.object.valid(pExcelApp) ) stop("'pExcelApp' is an invalid OLEClient object") if( !is.ole.object.valid(pWorkbook) ) stop("'pWorkbook' is an invalid OLEClient object") # If file pathname already exists, then nuke it if ( file.exists( sPathNameToSaveAs ) ) unlink( sPathNameToSaveAs ) # Retrieve the FileFormat from the specified workbook nFileFormat <- as.integer(get.ole.property(pWorkbook, "FileFormat")[[1]]) bReturn <- call.ole.method( pWorkbook, "SaveAs", sPathNameToSaveAs, nFileFormat ) return(bReturn) }
Start your day with Yahoo! - make it your home page |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Color code Scatter Plot......., Khan, Sohail |
|---|---|
| Next by Date: | tricky matrix problem, Jewel Bright |
| Previous by Thread: | Color code Scatter Plot......., Khan, Sohail |
| Next by Thread: | tricky matrix problem, Jewel Bright |
| Indexes: | [Date] [Thread] [Top] [All Lists] |