Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Editing Excel

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,49177
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Editing Excel
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Editing Excel - 7/8/2007 8:34:45 PM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
I am looking to open an existing Excel Spreadsheet and inseting some values into it.
Anyobody has the code to it?
Eveything I saw so far starts by creating a new excel file, I need to open in append or write mode....

cheers,

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net
 
 
Post #: 1
 
 RE: Editing Excel - 7/8/2007 11:42:36 PM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
strPathExcel = <path to existing excel file>
Set objExcel = CreateObject("Excel.Application")
   objExcel.Workbooks.Open strPathExcel

...the rest of your code...

objExcel.ActiveWorkbook.Save
objExcel.Quit

(in reply to 4scriptmoni)
 
 
Post #: 2
 
 RE: Editing Excel - 7/9/2007 12:11:41 AM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
Thanks it worked!!!

Is there a way to save(replace) quite

objExcel.ActiveWorkbook.SaveAs strPathExcel  (prompts to confirm replace)





      

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to Country73)
 
 
Post #: 3
 
 RE: Editing Excel - 7/9/2007 2:54:11 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
If you use "objExcel.ActiveWorkbook.Save" then you will save over the original file - without any prompts.
If you wish to save it with a different name then you would use "objExcel.ActiveWorkbook.SaveAs <new filename>"

Is that the answer you were looking for?

(in reply to 4scriptmoni)
 
 
Post #: 4
 
 RE: Editing Excel - 7/9/2007 5:54:45 AM   
  mcds99


Posts: 434
Score: 4
Joined: 2/28/2006
Status: online
Excel is fun with VBScript.

These will help you finish the work safe ;-)

strFolder = "C:\path\"                                         '### Sets a path to the Excel files
strFile = "filename"                                              '### Sets the file name to a variable handy if you need to work with more then one file.
strPathExcel = strFolder & strFile                        '### File to open and file to save
objExcel.DisplayAlerts = False                             '### suppresses pop up messages
objExcel.ActiveWorkbook.SaveAs strPathExcel  '### Saves the workbook
objExcel.Workbooks.close                                   '### Closes the workbooks
objExcel.Application.Quit                                     '### Quits Excel

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Country73)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Editing Excel Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts