Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Excel from Access Module

Status
Not open for further replies.

JoanieB

Programmer
Apr 17, 2001
57
US
I've asked about this before, but all the suggestions I've gotten have not solved the problem. Basically, I am formatting an excel spreadsheet from within Access and after I finish and save, I cannot open the spreadsheet in excel. I have tried: checking for instances of excel running, saving the workbook, closing the worksheet, closing the workbook.
Here's my code as it is now:
(All varibles are publicly defined within the module)

Set wks = GetObject("S:\DTC Recon Reports2\Recon " &
strCurrDte & "\DTC All Report.xls")
wks.Application.DisplayAlerts = False
Set objASht = wks.ActiveSheet
Set objPgSetup = objASht.PageSetup
wks.Parent.Visible = True
wks.Windows(1).Visible = True

'*{Format here, inserting lines, number formats, etc}

wks.Save
wks.Parent.Visible = False
wks.Windows(1).Visible = False

I have also tried running the code without visible = true stuff as well, but the formatting will not occur if I don't open the spreadsheet up to format.
Any suggestions?
Thanks.
MB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top