Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime error 1004


I open an Excel spreadsheet from within MS Access 2003.

I have the following code:

ExcelSheet.Application.Rows(intRow & ":" & intRow).Select
ExcelSheet.Application.Selection.Font.Bold = True
ExcelSheet.Application.Columns("B:B").Select
ExcelSheet.Application.Selection.HorizontalAlignme nt
"xlRight"


The first three lines work fine.
I select the current row and set the font to bold.
I then select colum B and want to set it to right align.

I get the following error msg:

Run-time error '1004'
Unable to set the HorizontalAlignment property of the Range class.

Found a tip on MS.com where you set Macro Security to allow VBA...
this doesn't work in this situation.

I created a macro within Excel, which works fine... just not fro
within MS Access.

Any ideas

--
edrecz
-----------------------------------------------------------------------
edreczk's Profile: http://www.excelforum.com/member.php...fo&userid=1609
View this thread: http://www.excelforum.com/showthread.php?threadid=27544

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Runtime error 1004

ExcelSheet.Application.Rows(intRow & ":" & intRow).Select
ExcelSheet.Application.Selection.Font.Bold = True
ExcelSheet.Application.Columns("B:B").Select
ExcelSheet.Application.Selection.HorizontalAlignme nt = xlRight

Take the quotes off xlRight

if you are using late binding, use the value of the constant:

ExcelSheet.Application.Selection.HorizontalAlignme nt = -4152

--
Regards,
Tom Ogilvy


"edreczk" wrote in message
...

I open an Excel spreadsheet from within MS Access 2003.

I have the following code:

ExcelSheet.Application.Rows(intRow & ":" & intRow).Select
ExcelSheet.Application.Selection.Font.Bold = True
ExcelSheet.Application.Columns("B:B").Select
ExcelSheet.Application.Selection.HorizontalAlignme nt =
"xlRight"


The first three lines work fine.
I select the current row and set the font to bold.
I then select colum B and want to set it to right align.

I get the following error msg:

Run-time error '1004'
Unable to set the HorizontalAlignment property of the Range class.

Found a tip on MS.com where you set Macro Security to allow VBA....
this doesn't work in this situation.

I created a macro within Excel, which works fine... just not from
within MS Access.

Any ideas?


--
edreczk
------------------------------------------------------------------------
edreczk's Profile:

http://www.excelforum.com/member.php...o&userid=16094
View this thread: http://www.excelforum.com/showthread...hreadid=275440



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error 1004 JB Bates[_2_] Excel Discussion (Misc queries) 5 December 29th 09 02:40 PM
runtime error 1004 HELP PLS Marcelo P Excel Discussion (Misc queries) 2 May 23rd 07 08:56 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
runtime error 1004 monika Excel Programming 3 February 11th 04 09:48 AM
runtime error 1004 Adella Excel Programming 2 July 29th 03 08:07 PM


All times are GMT +1. The time now is 02:36 AM.

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

About Us

"It's about Microsoft Excel"