A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel & Access Reporting



 
 
Thread Tools Display Modes
  #1  
Old January 11th, 2008, 04:39 PM posted to microsoft.public.access.reports
Hal2604 via AccessMonster.com
external usenet poster
 
Posts: 6
Default Excel & Access Reporting

I have a report in access where I am extracting some data out of excel to
generate the report. The code runs with out error, but comes out blank. On
the report the controls are lbl20-lbl27, & txt20-txt27. All of them are
labels. In the past I haven't been able to write excel to a text box. Below
is my code:


ClosingCount = 20
CenterCount = 40
CellNum = 3
PercentVAR = 5#

Set XLAPP = GetObject("Excel.Application") 'checks to see if an instance
of excel is running
If Err.Number 0 Then ' excel was not running
Set XLAPP = CreateObject("excel.application") ' creates an instance of
excel
End If

XLAPP.Visible = True
XLAPP.displayalerts = False
XLAPP.UserName = "PostCloseAnalyst1"

'Opens workbook
SysCmd acSysCmdSetStatus, "Opening Excel"
XLAPP.Workbooks.Open filename:="G:\Users\Post Close\clserr\NewPostClosing\
TotalErrors.xls"

Do While ClosingCount = 27 And PercentVAR 4.49 / 100
XLAPP.Windows("TotalErrors.xls").Activate
XLAPP.sheets("Summary").Select
XLAPP.Range("B" & CellNum).Select
PercentVAR = XLAPP.activecell
If XLAPP.activecell = 4.49 / 100 Then
XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=-1).Activate
Call CheckCenter(XLAPP.activecell) 'NJM 12/10
If bCenter = False Then 'closing errors
XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=1).Activate
Report!memorandumNJM.Activate
tempT = "txt" & ClosingCount
memorandumNJM.Controls(tempT).Caption = XLAPP.activecell
XLAPP.Workbooks("TotalErrors.xls").Activate
XLAPP.Windows("TotalErrors.xls").Activate
XLAPP.strCellLoc = XLAPP.activecell
XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=-1).Activate
Report!memorandumNJM.Activate
tempL = "lbl" & ClosingCount
memorandumNJM.Controls(tempL).Caption = XLAPP.activecell
memorandumNJM.Controls(tempT).Caption = Format(memorandumNJM.
Controls(tempT).Caption, "#0%")
ClosingCount = ClosingCount + 1
End If


End If
CellNum = CellNum + 1
Loop

Any help is appreciated.
Holly

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200801/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:28 PM.


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