Running a Macro inside a macro in excel (1 Viewer)

lobop3

Registered User.
Local time
Yesterday, 18:19
Joined
Nov 21, 2013
Messages
14
Hello,
I'm trying to record a macro that runs a macro. I have two sheets in my workbook. I'm on sheet 1 and move to recordedPositions. The I want the macro to run. I can manually go to sheet recordedPositions cell A4 and then manually run the macro and it all works fine. I want a one click action to do this. After I stop recording this is what I get. Just a reminder this is in Excel.

Sub restoreMainTable()
'
' restoreMainTable Macro
'


'
Sheets("recordedPositions").Select
Range("A4").Select

End Sub

I tried to add this line of code
DoCmd.runMacro "ResetFromRecorded"

Then it yells at me with the error of
Run-time error '424
Object required

I have no clue what to do. I tried
Dim x as object
x.Docmd.runmacro "my macro" that doesn't work.

Any advice?
 

contractor

Having Fun With Access
Local time
Yesterday, 16:19
Joined
Apr 12, 2012
Messages
47
Hi,

I presume that "ResetFromRecorded" is a sub in a module like "restoreMainTable".

so you can do the following :

Code:
Sub restoreMainTable()

Sheets("recordedPositions").Select
Range("A4").Select

Call ResetFromRecorded

End Sub

Success
 

lobop3

Registered User.
Local time
Yesterday, 18:19
Joined
Nov 21, 2013
Messages
14
Thank You! That is what I needed. Where can I find the functions or methods and object definitions for excel?
 

Users who are viewing this thread

Top Bottom