Access 2007 vba code to launch label wizard

D

datacstr

Does anyone know the vba code to lauch the label wizard in Microsoft Access
2007. And yes I need it as vba code. On the ribbon it is as follows -

Create Tab | Reports | Labels (Create Labels)

Help with this would be sincerely appreciated!
 
D

datacstr

Daniel,

Thank you so very, very much for taking the time to provide me with an
answer. I just tried it and it works like a charm. This is so very much
appreciated!

Monique aka datacstr
 
D

datacstr

Hi Daniel,

Its me again. I am wondering about one other thing. When I use this this
code it does effectively launch Label Wizard however, when I go through all
of the dialogue boxes in the Wizard and click Finish, the next message which
comes up is "Run command action cancelled" and it will not run any of my code
after that. This is even if i create another procedure to run the launch
wizard and call the procedure from another main procedure. Any suggestions.
 
D

datacstr

Hi Mark, although this was interesting it was not quite what I was looking
for. See Daniel's answer. It worked. I just need another little bit of
information. Thanks so much anyways.

DataCstr
 
M

Mark Andrews

I assume you found the code they used:

Private Sub LabelWizard_Click()
On Error GoTo ErrorHandler

' Code by Jeff Conrad
' This button launches the Label Report Wizard
' The second argument requires the name of a saved table or query name
' for the wizard to point to
Application.Run "acwzmain.mlbl_Entry", "Contacts"

ExitPoint:
Exit Sub

ErrorHandler:
'MsgBox "The following error has occurred:" _
'& vbNewLine & "Error Number: " & Err.Number _
'& vbNewLine & "Error Description: " & Err.Description _
', vbExclamation, "Unexpected Error"
MsgBox "In order to launch the labels wizard you must click the Open
button on the security notice." _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub

Sorry if that is not what you wanted.
Mark
 
D

datacstr

Hi Mark,

I have been meaning to get back to you. After I sent you the last message it
did occur to me to have a closer look at the application and see if I could
get behind the scenes. Yes then I found the code, and yes it worked like a
charm. It is actually the best solution so far as everything is handled by
the code. Thank you so very, very much for your attention to detail and for a
terrific answer. Muchly appreciated!

Monique
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top