请教:如何将visio 的vba代码 改写为vfp代码,謝謝!
请教:如何将visio 的vba代码 改写为vfp代码工作中常要将visio流程图作繁简中文转换,但visio没有转换键,故求助于vfp方式,请各位大神帮忙,万分感谢!
/需繁简转换的visio流程图.
环境:win10 / vfp9.0/visio 2016
*下面是visio 的vba代码
Option Explicit
Private Declare PtrSafe Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Long, ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest As Long) As Long
Private Function StoT(sIn As String) As String
Dim lStrLen As Long
lStrLen = LenB(sIn)
StoT = Space(lStrLen)
LCMapString &H804, &H4000000, sIn, lStrLen, StoT, lStrLen
End Function
Private Function TtoS(sIn As String) As String
Dim lStrLen As Long
lStrLen = LenB(sIn)
TtoS = Space(lStrLen)
LCMapString &H804, &H2000000, sIn, lStrLen, TtoS, lStrLen
End Function
Sub GBToBig5()
' 键盘快捷方式: Ctrl+w
'
'For Each cell In Selection
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
Dim R As Integer
Dim cell As Object
For Each cell In Application.ActiveWindow.Page.Shapes
'If Not Application.ActiveWindow.Page.Shapes.ItemFromID(R) Is Nothing Then
'If Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text <> "" Then
' Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text = StoT(Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text)
cell.Text = StoT(cell.Text)
'End If
'End If
Next
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
Sub Big5ToGB()
' 键盘快捷方式: Ctrl+w
'
'For Each cell In Selection
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
Dim R As Integer
Dim cell As Object
For Each cell In Application.ActiveWindow.Page.Shapes
'If Not Application.ActiveWindow.Page.Shapes.ItemFromID(R) Is Nothing Then
'If Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text <> "" Then
' Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text = StoT(Application.ActiveWindow.Page.Shapes.ItemFromID(R).Text)
cell.Text = TtoS(cell.Text)
'End If
'End If
Next
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub