Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
viddom
 
Posts: n/a
Default Error Running a Macro

Dear members,I am quite fresh using macros.Therefore,I would like you to be
patient:
A. Situation: I recorded a macro that must open a dataform where I can see
information about a small database in Excel, but when I run it, it tells me
that there is a mistake, then I debugged the macro and found out this in the
code

Sub LoadDataForm()
'
' LoadDataForm Makro
' Makro am 7/28/2005 von Vidal A. Castillo aufgezeichnet
'
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A4:V1366").Select
ActiveSheet.ShowDataForm
End Sub

B. The debugger tells me that the problem is in the line
"ActiveSheet.ShowDataForm" but I don't understand why

C. Can somebody tells me what am I doing wrong.

  #2   Report Post  
FSt1
 
Posts: n/a
Default

hi,
i'm assuming that your form name is dataform.

replace Activesheet.showdataform with

Load dataform
Dataform.show 0

regards

FSt1


"viddom" wrote:

Dear members,I am quite fresh using macros.Therefore,I would like you to be
patient:
A. Situation: I recorded a macro that must open a dataform where I can see
information about a small database in Excel, but when I run it, it tells me
that there is a mistake, then I debugged the macro and found out this in the
code

Sub LoadDataForm()
'
' LoadDataForm Makro
' Makro am 7/28/2005 von Vidal A. Castillo aufgezeichnet
'
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A4:V1366").Select
ActiveSheet.ShowDataForm
End Sub

B. The debugger tells me that the problem is in the line
"ActiveSheet.ShowDataForm" but I don't understand why

C. Can somebody tells me what am I doing wrong.

  #3   Report Post  
viddom
 
Posts: n/a
Default

I did it, but it didn't worked out. Some extra information will be useful:

1. The form is automatically generated by EXEL by selecting all the
information from my table, clicking DATA and then FORM
2. I see that the name of the form is the same than the worksheet,in this
case "Sheet1"
3. I don't understand why the code has "ActiveSheet.ShowDataForm"
4.My EXCEL is in german,but the code is generated in english

I hope it is useful for you

"FSt1" wrote:

hi,
i'm assuming that your form name is dataform.

replace Activesheet.showdataform with

Load dataform
Dataform.show 0

regards

FSt1


"viddom" wrote:

Dear members,I am quite fresh using macros.Therefore,I would like you to be
patient:
A. Situation: I recorded a macro that must open a dataform where I can see
information about a small database in Excel, but when I run it, it tells me
that there is a mistake, then I debugged the macro and found out this in the
code

Sub LoadDataForm()
'
' LoadDataForm Makro
' Makro am 7/28/2005 von Vidal A. Castillo aufgezeichnet
'
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A4:V1366").Select
ActiveSheet.ShowDataForm
End Sub

B. The debugger tells me that the problem is in the line
"ActiveSheet.ShowDataForm" but I don't understand why

C. Can somebody tells me what am I doing wrong.

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Here's an article that explains how the problem occurs in VBA (with solution)
http://support.microsoft.com/default...;en-us;q110462
XL: ShowDataForm Method Fails If Data Can't Be Found

Option Explicit
Sub testme01()
Application.DisplayAlerts = False
With activesheet
.Range("A4:V1366").Name = "'" & .Name & "'!database"
.ShowDataForm
End With
Application.DisplayAlerts = True
End Sub

(Did you want the range based on the selection or by the address???)

viddom wrote:

Dear members,I am quite fresh using macros.Therefore,I would like you to be
patient:
A. Situation: I recorded a macro that must open a dataform where I can see
information about a small database in Excel, but when I run it, it tells me
that there is a mistake, then I debugged the macro and found out this in the
code

Sub LoadDataForm()
'
' LoadDataForm Makro
' Makro am 7/28/2005 von Vidal A. Castillo aufgezeichnet
'
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A4:V1366").Select
ActiveSheet.ShowDataForm
End Sub

B. The debugger tells me that the problem is in the line
"ActiveSheet.ShowDataForm" but I don't understand why

C. Can somebody tells me what am I doing wrong.


--

Dave Peterson
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
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


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