Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sn sn is offline
external usenet poster
 
Posts: 4
Default problem writing an Excel file on server using Microsoft.ACE.OLEDB.

Hi,

I want to write an excel file on server from a client connection with
following code:

string ConnString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
Server.MapPath("../../ExcelTemplate/PrevalenceReportDownloadv2TEMPLATE.xls")
+ @";Extended Properties=""Excel 12.0;HDR=NO;""";

OleDbConnection cn = new OleDbConnection(ConnString);

cn.Open();

But, it fails to open the connection, giving following error:

System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is
not registered on the local machine

One thing here to note down is, the server has no office environment.
Does it need Office installed as a prerequisite ?
Or there is some other problem?

Hoping for a quick response.
Thanks for your help.

-Sulakshana.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default problem writing an Excel file on server using Microsoft.ACE.OLEDB.

If I understand you correctly, something like this may get you started:
Private Sub CommandButton2_Click()
Dim p As String
Dim f As String
Dim s As String
Dim r As String
Dim ws As Worksheet
p = "\\fsrv3\public\Sales Operations\Ryan\"
f = "East.xls"
s = "VP of Sales"
r = "I18:K20"
Set ws = ActiveSheet
Workbooks.Open (p & f)
' copy range values from current worksheet to same range in network file
ws.Range(r).Copy Workbooks(f).Worksheets(s).Range(r)
' close network file, saving changes
Workbooks(f).Close True
End Sub

Obviously, change to suit your specific situation!

Goodluck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"SN" wrote:

Hi,

I want to write an excel file on server from a client connection with
following code:

string ConnString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
Server.MapPath("../../ExcelTemplate/PrevalenceReportDownloadv2TEMPLATE.xls")
+ @";Extended Properties=""Excel 12.0;HDR=NO;""";

OleDbConnection cn = new OleDbConnection(ConnString);

cn.Open();

But, it fails to open the connection, giving following error:

System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is
not registered on the local machine

One thing here to note down is, the server has no office environment.
Does it need Office installed as a prerequisite ?
Or there is some other problem?

Hoping for a quick response.
Thanks for your help.

-Sulakshana.

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
Microsoft.ACE.OLEDB.12.0 - BUG Sven Pran Excel Discussion (Misc queries) 0 July 8th 08 06:42 PM
Microsoft.Jet.OLEDB error with csv file names [email protected] Excel Discussion (Misc queries) 0 May 14th 08 02:21 PM
Review of Microsoft.Jet.OLEDB.4.0 Connection Filo Excel Programming 0 May 12th 08 08:11 PM
Import data from Microsoft SQL Server into Microsoft Excel Joe K. Excel Programming 0 September 29th 07 03:40 PM
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the l henry Excel Programming 0 December 6th 06 03:38 AM


All times are GMT +1. The time now is 10:34 AM.

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

About Us

"It's about Microsoft Excel"