Formatting Excel from Access module

S

SarahHaynes

Hi All,

I am trying to get a module to reformat a Excel workbook then resave i
as different filename. So far I have gotten Access to open the boo
and write things in cells by looking through everyone's posts, but I a
still stuck on a few parts. I can get Access to select a row on th
spreadsheet, but not delete it or insert a new one and no luck on th
saveas function. Does anyone know how to fix this? Access is no
liking the lines in red (or says BAD at the start of the line, not sur
how the color thing works in here):

'Public Sub Start()
'Dim xlx As Object
'Dim xlw As Object
'Set xlx = CreateObject("excel.application")
'Set xlw = xlx.workbooks.Open("\\N6500PCB\home\SH\Raw.xls")

'With xlw.sheets(1)
' .Columns("A:A").Select
'BAD .Selection.Delete Shift:=xlToLeft
' .Columns("H:H").Select
'BAD .Selection.Delete Shift:=xlToLeft

' .Rows("1:1").Select
'BAD .Selection.Insert Shift:=xlDown

' .Cells(1, 1) = "Date"
' .Cells(1, 2) = "PNC Case#"
' .Cells(1, 3) = "Customer Name"
' .Cells(1, 4) = "Fraud Type"
' .Cells(1, 5) = "Amount"
' .Cells(1, 6) = "Action"
'End With

' Mydate = Format(Date, "mm-dd-yy")
' xlw.sheets("Sheet1").Select
' xlw.sheets("Sheet1").Name = Mydate

'BAD xlw.SaveAs Filename:= _
"\\N6500PCB\home\SH\Weekly Incident Report.xls", _ FileFormat:
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

'BAD xlw.SaveAs Filename:= _
"\\N6500PCB\home\SH\" + Mydate + ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:=""
ReadOnlyRecommended:=False _
, CreateBackup:=False

'xlw.Close

'End Sub.Selection.Delete Shift:=xlToLeft 'xlw.SaveAs Filename:=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top