Automatically open, save and close excel?
I need import data from Excel to SQL.
Now, I use tSQL to directly read the excel files and transform to the SQL table.
As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
However, this will make the data in the excel double and result a large excel file.
I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
Then I can directly use this excel for data import.
Is there any simple way to do so? I don't know marco much...
Ivan
No formula could do this (Automatically open, save and close excel).
You need to recode a marco or write a macro. Why donot you ask in msdn?
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
example:
Sub auto_open()
Application.OnTime Now + TimeValue("00:01:00"), "wswx"
End Sub
Sub
wswx() If Not ThisWorkbook.Saved
Then ThisWorkbook.Save
ThisWorkbook.Close
End Sub
KR
Similar Messages
-
Save and Close excel file opened through OLE
Hi,
I have opened an excel file on my desktop and edited it.Now I have to save this file and close it.
Right now , I am manually saving the file and closing it. So please give the steps to automate the process of saving and closing .
Please find the code below for opening a file and editing.
report zkntest2.
INCLUDE: <line>,
<icon>,
<symbol>,
ole2incl.
DATA: g_excel_app TYPE ole2_object,
g_excel_workbook TYPE ole2_object,
g_excel_worksheet TYPE ole2_object,
g_excel_usedrange TYPE ole2_object,
g_excel_cell TYPE ole2_object,
g_excel_return TYPE ole2_object.
data :H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
CONSTANTS:c_appl(17) TYPE c VALUE 'Excel.Application'.
SELECTION-SCREEN BEGIN OF BLOCK blk1 with frame title text-001.
PARAMETERS p_ofile LIKE rlgrap-filename default 'C:\layout.xls'.
SELECTION-SCREEN END OF BLOCK blk1.
CREATE OBJECT g_excel_app c_appl.
CALL METHOD OF g_excel_app 'Workbooks' = g_excel_workbook.
CALL METHOD OF g_excel_workbook 'Open'
EXPORTING #1 = p_ofile.
SET PROPERTY OF g_excel_app 'Visible' = 1.
CALL METHOD OF g_excel_app 'Workbooks' = H_MAPL.
PERFORM FILL_CELL USING 4 9 1 'Kiran'(001).
PERFORM FILL_CELL USING 5 9 1 'Ref#'(002).
PERFORM FILL_CELL USING 6 9 1 'Claim#'(003).
PERFORM FILL_CELL USING 7 9 1 'Location'(004).
FREE OBJECT g_excel_app.
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF g_excel_app 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
SET PROPERTY OF H_ZL 'Value' = VAL .
GET PROPERTY OF H_ZL 'Font' = H_F.
SET PROPERTY OF H_F 'Bold' = BOLD .
ENDFORM. "FILL_CELLTry add this code below.
CALL METHOD OF G_EXCEL_APP 'ActiveWorkbook' = G_EXCEL_WORKBOOK.
CALL METHOD OF G_EXCEL_WORKBOOK 'SaveAs' EXPORTING #1 = '1.xls'.
CALL METHOD OF G_EXCEL_WORKBOOK 'Close'.
CALL METHOD OF G_EXCEL_APP 'Quit'.
FREE G_EXCEL_APP. -
Save and close excel file using C#.
I am not sure why I get the following error for the below code. Everything seems to work otherwise.
Error found: System.Runtime.InteropServices.COMException (0x8002000B): Invalid index. (Exception from HRESULT: 0x8002000
B (DISP_E_BADINDEX))
Application _application;public void CloseFile(string filename, bool isSaveChanges)
_application.Workbooks[filename].Close(SaveChanges: isSaveChanges);I' work with excel files with connection you can save data and close connection Easy.
//connection String for xls file format.
if (fileExtension == ".xls")
excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
//connection String for xlsx file format.
else if (fileExtension == ".xlsx")
excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
//Create Connection to Excel work book and add oledb namespace
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
excelConnection.Open();
DataTable dt = new DataTable();
dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (dt == null)
return null;
String[] excelSheets = new String[dt.Rows.Count];
int t = 0;
//excel data saves in temp file here.
foreach (DataRow row in dt.Rows)
excelSheets[t] = row["TABLE_NAME"].ToString();
t++;
OleDbConnection excelConnection1 = new OleDbConnection(excelConnectionString);
string query = string.Format("Select * from [{0}]", excelSheets[0]);
using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, excelConnection1))
dataAdapter.Fill(ds);
Best Regards
Hakim. -
I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
I have 5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
[email protected]This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
!####.jpg!
h2. "Name####"
Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
Back of the Painting In Progress </p> </body> </html>
Warmest regards,
Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/ -
About one month ago, i started to receive a message box from firefox, asking if i wanted to save and close tabs, on newly open windows (and pop-ups) without any tabs open on them.
And everytime i close the windows without tabs, firefox asks it twice...
I did not made any changes, so i don't know why it started doing this.Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
* Don't make any changes on the Safe mode start window.
See:
* [[Troubleshooting extensions and themes]]
* [[Troubleshooting plugins]]
If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
* Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
* Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit") -
How to automatically open csv files in Excel on imac
I am migrating back from Google Chrome to firefox and would like to have the browser automatically open csv files to Excel on my mac desktop. The step to have them saved in the download folder and then go in an open it in Excel adds an unnecessary action. In the earlier versions of Firefox on my windows machine this worked as desired. Any help will be appreciated.
The Yahoo Finance server sends the file with the ''Content-Type: application/octet-stream'' header. This is a generic MIME type that doesn't describe the type of file. Therefore you will always see a download prompt, regardless of your download preferences.
* [https://developer.mozilla.org/docs/Web/Security/Securing_your_site/Configuring_server_MIME_types What are MIME types? | MDN]
To get around this issue, install the Force Content-Type add-on.
* https://addons.mozilla.org/firefox/addon/force-content-type/
In the Add-ons Manager, Extensions category, click the Options button next to Force Content-Type. Create two rules as follows:
* URL: '''(.csv)$''' Old Content-Type: '''text/plain''' New Content-Type: '''text/csv'''
* URL: '''(.csv)$''' Old Content-Type: '''application/octet-stream''' New Content-Type: '''text/csv'''
You should then be able to select what you want to do with CSV files (i.e. open them directly rather than save), and check the "Do this automatically…" option.
You're welcome. -
Write into worksheets and close excel
can someone tells me why this doesnt work?
i tried to
open excel, open worksheet, write to new worksheet #2, autofit to one page for work sheet #2,
write to new worksheet #3, autofit sheet #3.
all those are working...
but when i tried closing the excel and saving it is when i have alot of errors.
can someone help me?
thanks
Attachments:
Untitled 1.vi 18 KB
Untitled Project 1.lvproj 7 KBI'm not sure which version of LabVIEW you are using, nor what some of the VIs are in your code. However, if you have a recent version of LabVIEW (say 2012 or later) and have access to the Report Generation Toolkit, you will have a much easier time working with Excel.
In January of this year, I posted an Example to replace the Excel example that ships with LabVIEW. However, I'm not very good at finding my own posts on this forum, so I can't easily point you to it. However, if you do use the Report Generation Toolkit and do not use ActiveX calls, you will find that the functions to open and close Excel Reports tend to work without significant problems (there is a glitch, that I've reported, whereby if you "manually" close the Excel Workbook and then try to close it with the Report Generation's "Save Workbook", it will actually delete the manually-saved Workbook for you)(there is a "work-around" until NI fixes this ...).
Bob Schor -
Save and Close button issue in CRM 2013 for Activity Type Appointment
Hi All,
Have come across a strange behavior in CRM 2013 and would like to be sure that it really is an issue which others have encountered too.
Open a Case record, and click on Activity navigation link to see the Open Activity Associated View. Then try creating an Activity of type Meeting and click on
Save & Close button (not just Save). When you refresh the view, the activity might show up. But repeat the same steps and create another Activity of Type Meeting and this activity will not show up. It doesnt show up even in the All Activities
view. Seems like the activity does not get created when using Save and Close button.
This behavior is replicated even on online 30 day trial version. Any inputs?
Regards,
YogeshThe problem only occurs when your appointment times clash. "Save and close" just throws the appointment away. "Save" tells you about clash (or perhaps it's just unavailability) and allows you to ignore and continue with the
save. -
I have a typical popup window launched using the builtin javascript:popupURL().
I would like a Save and Close button on this popup window that does
1. Submits the popup page so that changes are saved into session state
2. Close the popup window
3. Refresh the parent window so that updates in (1) are reflected
What is the recommended way of doing this? I was thinking of the following URL redirect on the Save & Close button
doSubmit('SAVE');
window.opener.location.reload();
window.close();Do I need a same-page branch on the popup page? If so, why? If not, why? ;-)
Comments?
ThanksThis is a bit of javascript that I nicked which works well for me:
-- 1. Add the folowing to your page header or create a new page template --
-- (popup window template) and put it in the header section. --
SCRIPT LANGUAGE="JavaScript">
function loadinparent(url, closeSelf){
self.opener.location = url;
if(closeSelf) self.close();
</SCRIPT>
-- 2. Use the following to call the function. the true and false keeps the parent--
-- window open or closed. Obviously set any values in the URL. --
javascript:loadinparent(''<URL>'', true)
eg. javascript:loadinparent(''f?p=&APP_ID.:40:&SESSION.::NO::P40_ID:'||ID||''', true)
-- Inc the following comment in your header --
-- Version 1.0
-- Last Updated: May 18, 2000
-- Code maintained at:
-- http://www.moock.org/webdesign/javascript/
-- Copy permission granted any use provided this notice is unaltered.
-- Written by Colin Moock.
Simon -
Keep getting corrupted temp save file when I save and close.
When I save and close a numbers spreadsheet, about 20% of the time I will be left with the normal file and a weird temporary file with a "~" on the end of the file name. I can't delete the file or do anything with it. It will let me open it, but even when I save it still says I cant delete because the file is in use.
Example-
Work on spreadsheet1. Hit save and then close.
In finder I am left with-
spreadsheet1
spreadsheet1~
"spreadsheet1" is the correct file and it works and functions normally, but "spreadsheet1~" is corrupt and I cant seem to delete it. I always get "The operation can’t be completed because the item “spreadsheet1~” is in use.
What is causing this and how can I get rid of those files?I think I would ignore the files and not worry about them. Are you experiencing any undesirable effects of these files-- aside from seeing them there?
-
CRM 2013 - "Save and Close" button behavnig like "Save and New"
Hi,
I am working in CRM 2013. I have a scenario in which I am saving new opportunity product record through javascript and preventing original save of CRM. Save is working fine. After save, I need to refresh the screen. So I have used "Xrm.Utility.openEntityForm"
to open newly created item in edit mode. When I click on "Save and Close" button on this new form in edit mode, instead of closing the opportunity product screen, it opens new entity form. So in short, after saving the record, if I click on "Save
and Close", it behaves like "Save and New".
Any one facing such issue?Save & Close seems to behave like the Save & "Back" Button, so the form tries to return to the new form, that was opened before.
But I have no solution for this behavior... -
Save and close InDesign file CS4 JS
Hi, I need to save and close InDesign file after export pdf was done. Once export is complete the script opens the pdf file and the script gets interrupted. Here what I was trying and I am not sure if it even in the right direction:
#targetengine "session"
main();
function main(){
var myApplicationEventListener = app.eventListeners.add("afterExport",
mySaveInDesign, false);
var myDocumentEventListener = app.documents.item(0).eventListeners.add
("afterExport", mySaveInDesign, false);
app.scriptPreferences.version = 6.0;
var myEventNames = ["afterExport"] ;
function mySaveInDesign(myEvent){
var myDocument = myEvent.parent;
saveInDesign ();
function saveInDesign (){
//myDocument.save(myDocument);
app.activeDocument.save(myDocument);
app.activeDocument.close(myDocument);
Your help is highly appreciated.
YuliaSave either takes no argument (equivalent to the File/Save menu option) or a file path, equivalent to File/Save As.
So, your save commands aren't going to work as written. You either need just save(); or save(myDocument.fullName);
Dave -
Help me, please! skype automatically opens up and ...
I just downloaded skype for my laptop (MSI A6200) today to do a youtube lets play. However, some really weird things happened. For one, my mozilla firefox has msi open up before my homepage whenever I access it. Another thing is that on internet explorer, I have bing. (this doesnt affect me because I rarely use internet explorer). Also, whenever I turn on my laptop skype automatically opens up and I cannot close it. Skype is a really great way to chat with friends, but its affects are very VERY annoying. Please help me! (Like, info on how to get rid of all these things). Also I am running windows 7.
[Mod Edit to add info to Title]thnx for all the "replies". you guys are VERY VERY VERY helpful! 11/10 best staff ever.
-
Collapsible Panels - Links to open one, and close others
Hi,
I am new to Dreamweaver and have been creating my site by
learning as I go along. I have already read through all the other
related topics associated with Collapsible Panels on this blog and
have still not found an answer. I have been able to open and close
Collapsible Panels by using links - but unfortunately, I need more
than just opening and closing.
On my site i have approximately 5 pages, all with the same
header and Menu bar. The Information (that i have presented in
numerous Collapsible Panels) does however vary from page to page.
What I need to try and figure out is:
How can I open one collapsible panel and close all others? I
have seen the one example which leads to my next question:
How can I group Panels? Some examples of how to open one and
close all others use this grouping. Is there any other way of
opening one and closing all others without grouping?
Lastly, is it possible to set up a link that can be viewed on
one page which when clicked opens the relevant page and collapsible
panel? i.e. on my About Us page there is a link (using the Menu
bar) for one of my several services on the services drop down menu
(but services is on a different page with the same setup). When a
viewer clicks on the specific service, is it possible to get the
site to open the services page, and open the relevant collapsible
panel (with all other Panels closed)?
Any assistance would be greatly appreciated - I have been
searching for days now and cannot seem to find any
answers/directions in laymans terms.
Kind regards,
Johnwlsjoh013 wrote:
> Hi,
>
> I am new to Dreamweaver and have been creating my site
by learning as I go
> along. I have already read through all the other related
topics associated
> with Collapsible Panels on this blog and have still not
found an answer. I
> have been able to open and close Collapsible Panels by
using links - but
> unfortunately, I need more than just opening and
closing.
>
> On my site i have approximately 5 pages, all with the
same header and Menu
> bar. The Information (that i have presented in numerous
Collapsible Panels)
> does however vary from page to page. What I need to try
and figure out is:
>
> How can I open one collapsible panel and close all
others? I have seen the one
> example which leads to my next question:
This page has an example that has a link that can open and
close a panel:
http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/collapsible_panel_sample. htm
One way to do this would be to have a single link that would
open one of your panels using the code, but then add to it code
that closes each of the other panels, for example:
<a href="#"
onclick="CollapsiblePanel4.open();CollapsiblePanel5.close();CollapsiblePanel6.close();">O pen
4, close 5 and 6</a>
To make this work, you'll need to look that the panel
constructors at the bottom of your page and make sure to match up
the panel variable names i.e. "var CollapsiblePanel1 =...." the
variable is CollapsiblePanel1.
You could also write a function that gathers together the
various panels you have on the page and then pass to it only the
panel that you want kept open. For now, though, it might be best to
use the above method, given your expertise. And taking that even
further, you could apply the function call unobtrusively. Both the
function call and the unobtrusive part you can work on later to get
this working for now.
> How can I group Panels? Some examples of how to open one
and close all others
> use this grouping. Is there any other way of opening one
and closing all
> others without grouping?
This is a little confusing, on one hand you ask about how to
group, but then ask how not to group. There is a concept of a
collapsible panel group:
http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/CollapsiblePanelGroupSamp le.html
But there is another type of group, that may be more what
you're looking for, and that's an Accordion panel, which is similar
to the collapsible panel group, with the exception that it can only
have one panel open at a time.
> Lastly, is it possible to set up a link that can be
viewed on one page which
> when clicked opens the relevant page and collapsible
panel? i.e. on my About Us
> page there is a link (using the Menu bar) for one of my
several services on the
> services drop down menu (but services is on a different
page with the same
> setup). When a viewer clicks on the specific service, is
it possible to get
> the site to open the services page, and open the
relevant collapsible panel
> (with all other Panels closed)?
Probably the easiest way to do this particular one would be
to make sure that you have all of the panels set to be closed when
the page loads, and then take a look at the code for the last
example on this page:
http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html
That example uses a tabbed panel, but the concept is the
same, use a URL parameter to determine what to show. You'll need to
link in the SpryURLUtils file in the Spry download package (look in
the includes folder):
http://labs.adobe.com/technologies/spry/home.html
Essentially, your link will look similar to:
sample.html?panel=1
Then your code could look something like:
var params = Spry.Utils.getLocationParamsAsObject();
var CollapsiblePanel1 = new
Spry.Widget.CollapsiblePanel("CollapsiblePanel1",
{contentIsOpen:(params.panel==1 )} );
var CollapsiblePanel2 = new
Spry.Widget.CollapsiblePanel("CollapsiblePanel2",
{contentIsOpen:(params.panel==2 )} );
Basically what this is doing is creating an object from the
URL parameters. Then for each of the panels the constructor has
code that determines whether or not to expand the panel when the
page loads. So it checks the value of params.panel to see if it
matches 1 (for the first one), if it does, then that means that
contentIsOpen is set to true, if it is some other number or is not
present at all, then that means that the panel is closed. This
would then be repeated down the line for how ever many panels you
want to operate like that.
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert -
Open dataset and close dataset
Hi
I need to write log file in fileshare.
I am using the following FM to create the file.
Z_FILE_OPEN_OUT_UNICODE'
I have following qns
1. do i need to use open dataset and close dataset stmts, even I create the files with the FM?Hi,
you can fill in the name of the FM in transaction SE37, then click 'Display' and look at the source code and the 'Tables' tab.
It's a custom build FM, so you might have to look at the import parameters it needs... ( Tab 'Import' and 'Tables' ).
To answer your question, as the name of the FM suggests it will write the file for you, so no open/close dataset. Please doublecheck tab 'Source code' and you might find these statements there...
hope that helps,
Rolf
Maybe you are looking for
-
How can we choose to have different apps, different playlists, different contacts, etc., on each device., while using one itunes to sync more than 1 iphone
-
Inserting new line to a text file at position #
Hi,. Is it possible to do this in java? 1. Open a new text File (woutFile) 2. woutFile.write(" line #1\r\n"); // write new line 3. woutFile.write(" line #2\r\n"); // write new line 4.woutFile.write(" line #3\r\n"); // write new line 5. Go to line #2
-
How can I save controller assignments with a project?
How can I save controller assignments with a project, so that I can use different controller assignments for the same synth in another project Let's say I am controlling a Logic instrument with MIDI and CC data sent from MaxMSP. I have created a comp
-
I have some 1242 AP's set up with Cisco Fast roaming. My 3945 clients roam fine, but after a few seconds, they lose their IP address. If I have a constant ping going, my ping will drop for about 3 seconds, then replys will go for about 4 seconds. It
-
TS3694 IPHONE 3G CANNOT RESTORE AND UPDATE ERROR CODE 1015
IPHONE 3G CANNOT RESTORE AND UPDATE ERROR CODE 1015