Hi all,
I have a macro that retrieves data from AS400 (ISeries) and it saves in an excel format file. The point is that to run the retrieve it is mandatory to enter en username and a passaword. My macro works when there is just one user, because I declare I enter both variables in the code. But i want to share my macro with different users, so what I want to do is to create an Userform button to enter the credentials. Can anyone please show me how to relate an userform to my code?
Thank you very much!!!
I have a macro that retrieves data from AS400 (ISeries) and it saves in an excel format file. The point is that to run the retrieve it is mandatory to enter en username and a passaword. My macro works when there is just one user, because I declare I enter both variables in the code. But i want to share my macro with different users, so what I want to do is to create an Userform button to enter the credentials. Can anyone please show me how to relate an userform to my code?
Thank you very much!!!
Code:
Dim mysystem As New cwbx.AS400System 'Se declara el sistema al que llamará la macro
Dim bajararchivo As New cwbx.DatabaseDownloadRequest 'Se declara el objeto bajararchivo como petición de descaga
'Comienzo la subrutina
Sub bajararchivoAS400()
Set bajararchivo = New cwbx.DatabaseDownloadRequest
'Se definen los datos de la máquina
mysystem.Define "SINSCEE.DQB.COM"
mysystem.UserId = "Usuario"
mysystem.Password = "Contraseña"
Set bajararchivo.system = mysystem
bajararchivo.AS400File = "LP.LGF/GOAR" 'nombre del archivo
bajararchivo.pcFile = "C:\Users\rgumdrr\Desktop\MacroISeries\MastroArticulos\MaestroArticulos.xls" 'ruta donde bajar
bajararchivo.pcFile.FileType = cwbdtBIFF8 'tipo de archivo
bajararchivo.Download 'ejecuto la descarga
End Sub