📄 frmtransferir.frm
字号:
VERSION 5.00
Begin VB.Form FrmTransferir
Caption = "Transferencia de Datos"
ClientHeight = 2280
ClientLeft = 60
ClientTop = 345
ClientWidth = 3180
Icon = "FrmTransferir.frx":0000
LinkTopic = "Form1"
ScaleHeight = 2280
ScaleWidth = 3180
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command2
Height = 615
Left = 1560
Picture = "FrmTransferir.frx":030A
Style = 1 'Graphical
TabIndex = 3
Top = 1560
Width = 735
End
Begin VB.CommandButton Command1
Height = 615
Left = 720
Picture = "FrmTransferir.frx":0614
Style = 1 'Graphical
TabIndex = 0
ToolTipText = "Transferir Datos ..."
Top = 1560
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "To"
BeginProperty Font
Name = "Tahoma"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 2
Top = 240
Width = 375
End
Begin VB.Image Image3
Height = 480
Left = 1800
Picture = "FrmTransferir.frx":091E
Top = 120
Width = 480
End
Begin VB.Image Image2
Height = 480
Left = 720
Picture = "FrmTransferir.frx":0C28
Top = 120
Width = 480
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "La siguiente aplicacion transfiere los datos de una Tabla en FoxPro a una hoja de calculo en Excel"
BeginProperty Font
Name = "Tahoma"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 735
Left = 120
TabIndex = 1
Top = 720
Width = 2895
End
End
Attribute VB_Name = "FrmTransferir"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Copyright 2002 By RAMM
' email: r:mendez@hotmail.com
Option Explicit
#If Win32 Then
'Para 32 bits (VB4 y VB5)
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
#Else
'Para 16 bits (VB4 y VB3)
Private Declare Function GetSystemMenu Lib "user" (ByVal hwnd%, ByVal bRevert%) As Integer
Private Declare Function DeleteMenu Lib "user" (ByVal hMenu%, ByVal iditem%, ByVal wFlags%) As Integer
#End If
'Constantes
Const SC_SIZE = &HF000
Const SC_MOVE = &HF010
Const SC_MINIMIZE = &HF020
Const SC_MAXIMIZE = &HF030
Const SC_CLOSE = &HF060
Const SC_RESTORE = &HF120
Const MF_SEPARATOR = &H800
Const MF_BYPOSITION = &H400
Const MF_BYCOMMAND = &H0
Dim cnFox As ADODB.Connection, cnExcel As ADODB.Connection
Dim rsFox As ADODB.Recordset, rsExcel As ADODB.Recordset
Dim i As Long
Private Sub Command1_Click()
Screen.MousePointer = 11
Set cnFox = New ADODB.Connection
cnFox.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=" & App.Path & "\;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
cnFox.Open
Set rsFox = New ADODB.Recordset
rsFox.Open "select * from TPrueba", cnFox, adOpenForwardOnly, adLockReadOnly
Set cnExcel = New ADODB.Connection
cnExcel.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\TPruebaXLS.xls;Persist Security Info=False; Extended Properties=Excel 8.0;"
cnExcel.Open
Set rsExcel = New ADODB.Recordset
rsExcel.CursorLocation = adUseClient
rsExcel.Open "select * from [Data$] where Cliecod = ''", cnExcel, adOpenKeyset, adLockOptimistic
While Not rsFox.EOF
rsExcel.AddNew
For i = 0 To rsExcel.Fields.Count - 1
rsExcel(rsFox(i).Name) = rsFox(i)
Next i
rsExcel.Update
rsFox.MoveNext
Wend
' Utiliza este codigo para eliminar los datos de la tabla en fox
'If rsFox.RecordCount > 0 Then
' rsFox.MoveFirst
' While Not rsFox.EOF
' rsFox.Delete
' rsFox.MoveNext
' Wend
'End If
rsExcel.Close
Set rsExcel = Nothing
rsFox.Close
Set rsFox = Nothing
cnExcel.Close
Set cnExcel = Nothing
cnFox.Close
Set cnFox = Nothing
Screen.MousePointer = 0
MsgBox ("Datos Transferidos"), vbInformation
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
#If Win32 Then
Dim hwnd&, hMenu&, Success&
#Else
Dim hwnd%, hMenu%, Success%
#End If
Dim i%
hwnd = Me.hwnd
hMenu = GetSystemMenu(hwnd, 0)
'Quitar todos (va de 0 a 8)
For i = 8 To 0 Step -1
Success = DeleteMenu(hMenu, i, MF_BYPOSITION)
Next
Exit Sub
'Usa esto para quitar los men鷖 que te interesen:
Success = DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -