只是想知道把宏放在哪裏。它應該導致正確標記的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