Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default problem with selection when calling macro externally from VB6

hi I have the following code which runs fine when i call it from
within the macro of the spreadsheet. However when I canll it from
outside, ie from vb6. I get a type mismatched error when i try and
protect the cells.

Has any one ever seen this before, is there any way around this? Is
the obvious just to not use selection and manually set each cell
indivually?

here the code - thx alot.


ActiveSheet.Cells.Select
Selection.Locked = True <---gives me a type mismatch problem
here when i call from outside
ActiveSheet.Cells(1, 1).Select
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default problem with selection when calling macro externally from VB6

Philip,

Have you created an Excel object, and referenced the Excel objects through
that application object.

For instance

Set xlApp = GetObject("Excel.Application")
Set xlWb = xlAPp.ActiveWorkbook
xlWb.ActiveSheet.Cells.Locked = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
om...
hi I have the following code which runs fine when i call it from
within the macro of the spreadsheet. However when I canll it from
outside, ie from vb6. I get a type mismatched error when i try and
protect the cells.

Has any one ever seen this before, is there any way around this? Is
the obvious just to not use selection and manually set each cell
indivually?

here the code - thx alot.


ActiveSheet.Cells.Select
Selection.Locked = True <---gives me a type mismatch problem
here when i call from outside
ActiveSheet.Cells(1, 1).Select



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
calling macro in a formula rk0909 Excel Discussion (Misc queries) 2 March 14th 06 04:15 PM
Calling an XLA macro from code Chrissy[_4_] Excel Programming 2 October 11th 03 04:38 PM
calling a macro from within a loop Rick[_12_] Excel Programming 1 July 30th 03 11:52 PM
calling a macro from within a loop Mike Hughes Excel Programming 0 July 30th 03 08:50 PM
Calling macro in add-in. Clark B Excel Programming 1 July 24th 03 11:05 PM


All times are GMT +1. The time now is 10:25 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"