Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Opening Files

Hi

Could someone provide me with code to do the following please:

While using Access I and need to open an Excel spread sheet then save it. I
can do this using Excel only, but need to do this within Access

Please help


Dave

--
Please type david.com inplace of no.thanks.
Sorry for the inconvenience but fed up of spam mail.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening Files

Look in VBA help for createobject and getobject

Dim xlApp as Object
Dim xlBook as Object
Dim xlSheet as Object
set xlApp = CreateObject("Excel.Application")
set xlBook = xlApp.Workbooks.Open "C:\My Folder\MyFile.xls"
' or
'Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Cells(1,1).Value = 1
xlBook.Save
' or xlBook.SaveAs "C:\My Folder\MyFile1.xls"
xlBook.close SaveChanges:=False
set xlsheet = nothing
set xlBook = nothing
xlApp.Quit
set xlApp = Nothing

some references:
http://support.microsoft.com/support...aqVBOffice.asp
Frequently Asked Questions about Microsoft Office Automation Using Visual
Basic


http://support.microsoft.com/support...fdevinapps.asp
Programming Office from Within Office

http://support.microsoft.com/support...dev/iisfaq.asp
Integrating Office with IIS FAQ

http://support.microsoft.com/?id =219151
Q219151 - HOWTO: Automate Excel 97 and Excel 2000 from Visual Basic

http://support.microsoft.com/support...automation.asp
Using Automation with Microsoft Excel 97

http://support.microsoft.com/?id=153748
ACC: How to Call Excel Functions from Within Microsoft Access

Automating Excel from VB and from Access is identical.

--
Regards,
Tom Ogilvy

"Dave" wrote in message
...
Hi

Could someone provide me with code to do the following please:

While using Access I and need to open an Excel spread sheet then save it.

I
can do this using Excel only, but need to do this within Access

Please help


Dave

--
Please type david.com inplace of no.thanks.
Sorry for the inconvenience but fed up of spam mail.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening Files

Here are two mo

http://support.microsoft.com/?id=153748
ACC: How to Call Excel Functions from Within Microsoft Access

http://support.microsoft.com/?id=167223
Microsoft Office 97 Automation Help File Available on MSL

--
Regards,
Tom Ogilvy

"Dave" wrote in message
...
Hi

Could someone provide me with code to do the following please:

While using Access I and need to open an Excel spread sheet then save it.

I
can do this using Excel only, but need to do this within Access

Please help


Dave

--
Please type david.com inplace of no.thanks.
Sorry for the inconvenience but fed up of spam mail.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening files Sandy5590 Excel Discussion (Misc queries) 2 September 8th 09 02:03 PM
show most recent files first when opening excel files Anne` Excel Discussion (Misc queries) 5 January 23rd 08 01:54 AM
Opening Quattro Pro for Windows files (*.WB1 Files) using Excel 20 PoundMutt Excel Discussion (Misc queries) 1 June 20th 07 03:50 AM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM
opening files Dan E[_2_] Excel Programming 0 September 5th 03 04:25 PM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"