Data Loading help using VBA

ijswalker

Registered User.
Local time
Today, 08:13
Joined
Jun 16, 2008
Messages
67
Hi,

I am trying to upload information into a Lawson Database. The Form has a
function but I am having trouble fuguring out which control ID it is. The regular upload interface add-in doesn't support the Load button. Can anyone tell me which part of this code refers to a button control? I think I could then figure it out from there,

Thanks

Ian


Option Explicit
Const MAIN_MENU_BAR = "Worksheet Menu Bar"
Const MENU_BAR_NAME = "&Lawson"
Const SUBMENU_BAR_NAME = "Upload Wizard"
Const SUBMENU_BAR_EVENT = "Launch_Upload_Wizard"

Public Sub Auto_Open()
Dim subMenu As Object
Dim subMenu2 As Object

On Local Error Resume Next

Set subMenu = CommandBars(MAIN_MENU_BAR).Controls(MENU_BAR_NAME)

If subMenu Is Nothing Then
With CommandBars(MAIN_MENU_BAR)
.Controls.Add(Type:=msoControlPopup, Before:=7).Caption = MENU_BAR_NAME
End With
Set subMenu = CommandBars(MAIN_MENU_BAR).Controls(MENU_BAR_NAME)
End If

Set subMenu2 = subMenu.Controls(SUBMENU_BAR_NAME)

If subMenu2 Is Nothing Then
subMenu.Controls.Add(Type:=msoControlButton).Caption = SUBMENU_BAR_NAME
subMenu.Controls(subMenu.Controls.Count).OnAction = SUBMENU_BAR_EVENT
End If

End Sub
Public Sub Auto_Close()
Dim subMenu As Object
Dim subMenu2 As Object

On Local Error Resume Next

Set subMenu = CommandBars(MAIN_MENU_BAR).Controls(MENU_BAR_NAME)

If Not (subMenu Is Nothing) Then
If subMenu.Controls.Count > 1 Then
Set subMenu2 = subMenu.Controls(SUBMENU_BAR_NAME)
If Not (subMenu2 Is Nothing) Then
subMenu2.Delete
End If
ElseIf subMenu.Controls.Count = 1 Then
Set subMenu2 = subMenu.Controls(SUBMENU_BAR_NAME)
If Not (subMenu2 Is Nothing) Then
subMenu.Delete
End If
ElseIf subMenu.Controls.Count = 0 Then
subMenu.Delete
End If
End If

End Sub
Sub Launch_Upload_Wizard()
On Error Resume Next

Dim x As Lawson_UploadWizard.UploadWizard
Set x = New Lawson_UploadWizard.UploadWizard
x.StartUploadWizard

Set x = Nothing
End Sub
 
I would say that the code associated with the Load Wizard button is at the very bottom of the code you posted:

Code:
Sub Launch_Upload_Wizard()
   On Error Resume Next
   Dim x As Lawson_UploadWizard.UploadWizard
   Set x = New Lawson_UploadWizard.UploadWizard
   x.StartUploadWizard

   Set x = Nothing
End Sub

If it doesn't work then comment out the On Error Resume Next and try again. What Error do you get?

Check your References. Make sure reference to the Lawson Upload Wizard is intact.

.
 

Users who are viewing this thread

Back
Top Bottom