By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,122 Members | 927 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,122 IT Pros & Developers. It's quick & easy.

Hiding field names

P: n/a
Can anyone help me?

Please see the code I'm using now.

Public Function sheetlayout()
On Error GoTo Err_Command1_Click
Dim xl As Object
Set xl = GetObject("c:\windows\desktop\123.csv")
xl.Application.Visible = True
xl.Parent.windows(1).Visible = True
xl.sheets("excellist").Select
xl.sheets("excellist").Rows("1:1").Select
xl.Application.selection.Delete = True
xl.Application.Save
xl.Application.Quit

Set xl = Nothing
Exit Function

Err_Command1_Click:
MsgBox Err.Description
Resume Next

Exit Function
End Function
However, after "xl.Application.selection.Delete = True" I'm getting a
message "Unable to set the delete property of the range class"
After "Resume Next" a new file is created on the Desktop with the name
Resume.
What am I doing wrong?
Please help!!
Thanks
=======================

M.***********@uva.nl (Marc) wrote in message news:<ae**************************@posting.google. com>...
my*****@hotmail.com (Jacky11) wrote in message news:<46**************************@posting.google. com>...
Subject: Hiding field names.
I'm exporting a query with a lot of strings to Excel.
When exporting - is there any way to have the field name hidden or
removed from the query by default?
I don't need the field name as a heading on the excel sheet.

=============

Jacky,
4. You could create a menu-item or commandbutton on a form to start a
macro and/or VBA-procedure like in my example.

success, Marc

example based on one of my own applications:
I had a query to export to a spreadsheet and to do a little layouting
from access.
To hide the column-names you could add:
xl.application.selection.hidden = true

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Delete is not a property it is a method. Try this:

xl.sheets("excellist").Rows("1:1").Select
xl.Application.selection.Delete

Or this:

xl.sheets("excellist").Rows("1:1").Delete

HTH

Rick Collard
www.msc-lims.com
On 15 Sep 2003 13:50:52 -0700, my*****@hotmail.com (Jacky11) wrote:
Can anyone help me?

Please see the code I'm using now.

Public Function sheetlayout()
On Error GoTo Err_Command1_Click
Dim xl As Object
Set xl = GetObject("c:\windows\desktop\123.csv")
xl.Application.Visible = True
xl.Parent.windows(1).Visible = True
xl.sheets("excellist").Select
xl.sheets("excellist").Rows("1:1").Select
xl.Application.selection.Delete = True
xl.Application.Save
xl.Application.Quit

Set xl = Nothing
Exit Function

Err_Command1_Click:
MsgBox Err.Description
Resume Next

Exit Function
End Function
However, after "xl.Application.selection.Delete = True" I'm getting a
message "Unable to set the delete property of the range class"
After "Resume Next" a new file is created on the Desktop with the name
Resume.
What am I doing wrong?
Please help!!
Thanks
=======================

M.***********@uva.nl (Marc) wrote in message news:<ae**************************@posting.google. com>...
my*****@hotmail.com (Jacky11) wrote in message news:<46**************************@posting.google. com>...

Subject: Hiding field names.
I'm exporting a query with a lot of strings to Excel.
When exporting - is there any way to have the field name hidden or
>removed from the query by default?
>I don't need the field name as a heading on the excel sheet.

=============

Jacky,
4. You could create a menu-item or commandbutton on a form to start a
macro and/or VBA-procedure like in my example.

success, Marc

example based on one of my own applications:
I had a query to export to a spreadsheet and to do a little layouting
from access.
To hide the column-names you could add:
xl.application.selection.hidden = true


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.