Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2000, Macro's and VB

Status
Not open for further replies.

pea2k

Programmer
May 5, 2001
4
GB
basically im sure this is very simple to do, i just cant get my head around it.

Im new to this by the way :)

Ive created a macro to switch to a different workbook (details.xls) that is already open and it selects the sheet Customers, it is then assigned to open the data entry form. This all works, however when it opens the data entry form details from customer number 1 is already inputed in the form.

the code at the moment is..

Sub NewCustomer()
'
' NewCustomer Macro
' Macro recorded 04/05/2001 by J Corry
'

'
Windows("Details.xls").Activate
Sheets("Customers").Select
ActiveSheet.ShowDataForm
End Sub

but what i want is it to clear the data entry form's contents or make a new record so that there are no details entered once it opens.

if you know of anyway to do this please help me :)

Thanks
Jonny
 
I don't know much about forms. How about trying :

Code Amount Group Date Etc. . .
Default 99.99 AA 5/01/01

to let the user know you want the first record filled out?
 
hmmm.. doesnt sound like its what im looking for :(

cheers 4 reply tho
 
In your macro code after showing the dataform try using the sendkeys method like this...

sendkeys "%W", True

The %W will send ALT W to the window with focus (data form) to create a new record.

I haven't tried this out, so could you come back to the thread to tell me how you got on? Thanks.

Klae

You're only as good as your last answer!
 
hmm didnt seem to work.. but maybe i got it wrong somewhere.. i just found out how to view the code of a spreadsheet but u cant actually view the code when the data entry box is open :(

this is doing my nut in now.. thanks to help anyways
 
I've just looked at the VBA help for the function worksheet.ShowDataForm and it says that macro code PAUSES until the form is gone. So the answer looks like a big fat NO, unless you are willing to actually program your own form which does the same thing. This will take (in my opinion) far too much effort.
Klae

You're only as good as your last answer!
 
lol.. no problem.. i'll just leave it.. thanks for trying
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top