compile error type mismatch in macro on excel file

I

I.M. Shatner

I'm having trouble getting this macro to run in Excel. It stops at the line
in between the arrows, telling me "Complie Error: Type Mismatch". I'm a
complete novice at this so please help!


Sub BOM()
'
Dim myobject As Object
Dim object As String
Set oApp = myobject
oApp.Visible = True

oApp.cells.select

With selection.Font
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
oApp.selection.Rows.AutoFit
oApp.selection.Columns("A:A").select
oApp.selection.Font.Bold = True
oApp.selection.Range("A1").select
End Sub
 
F

fredg

I'm having trouble getting this macro to run in Excel. It stops at the line
in between the arrows, telling me "Complie Error: Type Mismatch". I'm a
complete novice at this so please help!

Sub BOM()
'
Dim myobject As Object
Dim object As String

Set oApp = myobject
oApp.Visible = True

oApp.cells.select

With selection.Font
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
oApp.selection.Rows.AutoFit
oApp.selection.Columns("A:A").select
oApp.selection.Font.Bold = True
oApp.selection.Range("A1").select
End Sub

You have posted this question to the wrong newsgroup.
The access in this groups title refers to Microsoft Access, a database
program.
Please repost to the correct newsgroup for the Excel program you are
using.
I would suggest you include your Windows and Office version number in
your message. It might make a difference.
 
I

I.M. Shatner

Sorry - I left some details out. Also sorry about the multiple posts. I
kept getting "Server Unavailable" messages, so I clicked "Post" multiple
times.

I thought this would be an Access question because this module is in Access.
The Excel file in question is created after an OutputTo macro. I want this
macro to run after a Call command in that OutputTo macro. When I run that
one it creates the file then stops at the line in the 2nd module that I noted
below. Is there a better way to have the Excel formatting happen
automatically after the OutputTo macro?

I have Office 03 and Windows XP.

Thanks!
 

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