473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem creating Excel files from an Access Module

Everything works fine in Access, but when I double-click on the
resultant Excel files the first one opens correctly, but subsequent
ones, and any other Excel files I try to open, fail to display at all;
I get the Excel window frame with corrupted contents. The only way I
can get decent functionality from Excel is to open Excel from the
Start menu, open each of these new files from the Excel File menu, and
save each one. Thereafter Excel functions normally, except that,
probably the first time I opened one of these files, my Excel
preferences were all changed (probably reverted to default?), and
Excel no longer looks the way I am accustomed to seeing it.

I cannot send these files out to the recipient sites if they will
overwrite the Excel user preferences at each site. I could
conceivably open and save each one before sending it, but that takes a
large bite out of the purpose of automating this process.

Any ideas about what I need to do differently to save these files as
well-behaved Excel files?

Thanks,
-Richard
pseudoCallingRoutine
initialize site_hold to -1 (all site IDs are posints)
.-if user selects folder for output
| .-if ordered ADODB.Recordset successfully opened & > 0 records
| | .-for each record
| | | .-if RecSet.SiteID <> site_hold
| | | | if site_hold <> -1 then uSaveXLS
| | | | if not uNewXLS then exit with an error message
| | | | save RecSet.SiteID in site_hold
| | | | generate filespec as C:\folder\sitename.xls
| | | | format some cells
| | | | (re)initialize row counter
| | | `---end if
| | | populate row with values from this record
| | | increment row counter
| | `---next record
| | uSaveXLS 'last one
| `---end if
`---end if
end procedure

Public Function uNewXLS(xl As Object, ws As Worksheet) As Boolean
uNewXLS = False
On Error GoTo ErrExit
Set xl = CreateObject("Excel.Sheet")
Set ws = xl.Worksheets(1)
uNewXLS = True
ErrExit:
End Function

Public Sub uSaveXLS(filespec As String, xl As Object, ws As Worksheet)
ws.SaveAs filespec
Set ws = Nothing
Set xl = Nothing
End Sub
--
================================================== ====================
Richard Hopley Winston-Salem, NC, USA
rhopley[at]earthlink[dot]net
Nothing really matters except Boats, Sex, and Rock'n'Roll
rhopley[at]wfubmc[dot]edu
OK, OK; computer programming for scientific research also matters
================================================== ====================
Nov 12 '05 #1
0 2456

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alan | last post by:
Hi there, Are there Excel charting gurus here?? If so then please read on... Sorry for the cross-post but I'm not familiar with the Excel groups. I've posted to asp.general because if I have...
2
by: Jen | last post by:
Trying to take one table in access and split it into multiple excel files(using an excel template); and then email based on email addresses in Table2; Of course, I would like to do all of this...
9
by: Gordon | last post by:
Hello again, Sorry to repost this request, but I'm under a bit of pressure to find a quick solution. All I basically want is an automatically updating link (OLE, not DDE) between a control in...
1
by: koia | last post by:
Hi, I have a problem with adding attributes to a Line in an Excel drawing using the Python win32com interface. From recording in Excel I get the Macro: Sub Makro1()...
3
by: excyauseme | last post by:
Hi guys! Do you know what is the best way to export a text file, this one is a log file that is already comma delimited thru a module run by my access database, to an excel spreadsheet? I need to...
11
by: MD | last post by:
Hello, I need to import a sheet of 884 different excel-file with same lay- out. The sheet name is 'Totaal' and is the same in all different files. Is there a script (module) in order to: 1....
0
by: mcc99 | last post by:
Amazing, I surfed around to find a simple utility that could list files recursively from a given top folder down through it, writing out the path and filename in simple \path\file_name form, without...
15
by: =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= | last post by:
Hi All, We are in the process of Upgrade Excel 2003 (Office 2003) to Excel 2007 (Office 2007) for one of web application. This web application is using Excel (Pivot Table) reports. With Excel...
11
by: nartla | last post by:
Hello, I work on an app developped with Access/VBA and communicating with a SQL Server database via ODBC. My problem is that I have to manage a big string which can be 0 to 1024 characters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.