使用WPS的用户会发现WPS中没有宏选项,那么如何在WPS中启用宏呢?工具/原料WPSVBA for WPS方法/步骤1下载VBA for WPS。
可以百度一下。也可以点击链接:参考网址。
wps开启宏的步骤如下:
1、这里以WPS2019为例,首先打开浏览器,在搜索引擎中搜索“VBA for wps”,选择任意一个网站下载vba安装程序回来备用:
2、下载后VBA FOR WPS .exe开始安装点击下一步:
3、稍等一会安装完毕,点击完成就装好了:
4、最后打开wps2019,点击上面的选项开发根据,就看到有关宏的功能都可以用了:
您好,很高兴为您解答!
WPS个人版中没有宏功能,可以【学习帖】VBA的使用及VBA下载/wpswfw
如有疑问,请点击我的头像提问。祝您生活愉快!
'以下为代码,请复制到vba编辑器中,然后可以运行main宏来创建目录页。
Sub main()
'Dim Workbook As Workbook
'Dim cSheet, sht As Worksheet
'Dim et As Application
'Dim Rng As Range
'Dim i, j As Integer
'Dim k As String
Set et = ThisWorkbook.Application
'Set et = GetObject(, "et.application")
Set Workbook = et.ActiveWorkbook
Set cSheet = Workbook.ActiveSheet
If cSheet.Name "目录" Then
Set cSheet = Workbook.Sheets.Add(Workbook.Sheets(1))
cSheet.Name = "目录"
End If
cSheet.Activate
Set Rng = et.Selection
i = Rng.Row
j = Rng.Column
If MsgBox("是否要在各Sheet(除目录页)的左上角(A1格)创建返回目录页的链接?", vbYesNo + vbQuestion) = vbYes Then
MakeBacklink = true
End if
For Each sht In Workbook.Sheets
If sht.Name "目录" Then
cSheet.Hyperlinks.Add cSheet.Cells(i, j), "", "'" & sht.Name & "'!A1", "跳转到工作表""" & sht.Name & """", sht.Name
i = i + 1
If MakeBacklink Then
If IsEmpty(sht.Cells(1, 1)) Then
k = "[返回目录]"
Else
k = CStr(sht.Cells(1, 1))
End If
sht.Hyperlinks.Add sht.Cells(1, 1), "", "目录!A1", "返回目录", k
End If
End If
Next
End Sub
wps使用宏功能的办法:
1、首先我们要明确,wps本身不能直接启用宏功能,要下载组件才可以。
2、接下来在网上搜索VBA软件(组件)安装版,找到对应的。
3、点进去后,进行下载,下载安装版。
4、下成功后解压压缩包,到某一文件夹,并打开,找到绿化&卸载。
5、双击打开,进入操作页面。
6、点击一或者二,选择不同的版本,最后点击回车进行调用。
7、成功无误后,接下来重启wps,找到开发工具,便可看到宏命令。
'以下为代码,请复制到vba编辑器中,然后可以运行main宏来创建目录页。
Sub main()
'Dim Workbook As Workbook
'Dim cSheet, sht As Worksheet
'Dim et As Application
'Dim Rng As Range
'Dim i, j As Integer
'Dim k As String
Set et = ThisWorkbook.Application
'Set et = GetObject(, "et.application")
Set Workbook = et.ActiveWorkbook
Set cSheet = Workbook.ActiveSheet
If cSheet.Name "目录" Then
Set cSheet = Workbook.Sheets.Add(Workbook.Sheets(1))
cSheet.Name = "目录"
End If
cSheet.Activate
Set Rng = et.Selection
i = Rng.Row
j = Rng.Column
If MsgBox("是否要在各Sheet(除目录页)的左上角(A1格)创建返回目录页的链接?", vbYesNo + vbQuestion) = vbYes Then
MakeBacklink = true
End if
For Each sht In Workbook.Sheets
If sht.Name "目录" Then
cSheet.Hyperlinks.Add cSheet.Cells(i, j), "", "'" & sht.Name & "'!A1", "跳转到工作表""" & sht.Name & """", sht.Name
i = i + 1
If MakeBacklink Then
If IsEmpty(sht.Cells(1, 1)) Then
k = "[返回目录]"
Else
k = CStr(sht.Cells(1, 1))
End If
sht.Hyperlinks.Add sht.Cells(1, 1), "", "目录!A1", "返回目录", k
End If
End If
Next
End Sub