只是想知道把宏放在哪里。它应该导致正确标记的Excel文件ato保存为PDF格式,以及每当用户点击保存。我有一个类似的宏工作没有Word的问题,但对我的生活,我似乎无法计算出这个宏的去向。Excel宏插件 - 插件的位置
我在XP SP3运行与Excel 2007年我已经尝试将其保存在一个模块中一个.xlam到C:\Program Files\Microsoft Office\Office12\XLSTART
,C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Office\12.0
,C:\Documents and Settings\username\Templates
等,但没有喜悦之内?
我错过了一些明显的东西(没有意外)?
Sub FileSave()
'
' FileSave Macro
'
'
Dim StrFile As String
Dim StrPath As String
Dim StrName As String
Dim StrPDFName As String
StrPath = ActiveSheet.Path 'Get document path
StrFile = ActiveSheet.Name 'Get document name
If StrName <> "" Then
MsgBox "We have a string name"
StrName = Left(StrFile, (InStr(StrFile, ".") - 1))
StrPDFName = StrPath + "\" + StrName + ".pdf"
If InStr(StrFile, "_fmpro_temp") Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= StrPDFName, _
Quality:= xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
MsgBox StrName + " has been saved. " & vbNewLine & _
"If you're finished, please close the file," & vbNewLine & _
"and return to FileMaker to accept or discard this version.", _
vbInformation, "FileMaker Pro Versioning"
End If
End If
End Sub
为什么要在第一个'If'之前添加'debug.print strPath,strFile'?这应该给你一个暗示,我猜。 – 2012-02-17 14:06:36
我也试过'C:\ Program Files \ Microsoft Office \ Office12 \ Startup'这应该是一个值得信赖的位置... – Dycey 2012-02-17 14:20:07
@Dycey:你的问题是否分类? – 2012-03-05 05:10:56