gpt4 book ai didi

vba - 从单元格中选择保存路径

转载 作者:行者123 更新时间:2023-12-04 21:37:43 25 4
gpt4 key购买 nike

我有以下代码:

Const SAVE_PATH = "S:\Divisional Support\RVU Programs\Payroll 2015\2015-04 April\PDF's\Baptist Easley"

'paste file destination in the above location'

Dim cell As Range
Dim wsSummary As Worksheet
Dim counter As Long

Set wsSummary = Sheets("PERFORM. SUM. - EASLEY")

For Each cell In Worksheets("NAME KEY").Range("$H:$H")
If cell.Value <> "" Then

'progress in status bar
counter = counter + 1
Application.StatusBar = "Processing file: " & counter & "/1042"

With wsSummary
.Range("$A$4").Value = cell.Value
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=SAVE_PATH & "\" & cell.Value & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End With
End If
Next cell


Set wsSummary = Nothing
End Sub

我的问题很简单,无需进入代码来更改保存位置: Const SAVE_PATH = "S:\Divisional Support\RVU Programs\Payroll 2015\2015-04 April\PDF's\Baptist Easley"
我希望能够在单元格 J2 中发布该位置,我将如何编码?

最佳答案

I want to be able to post that location in cell J2, how will I code that?



其实很简单

换行
FileName:=SAVE_PATH & "\" & cell.Value & ".pdf"


FileName:=Thisworkbook.Sheets("Sheet1").Range("J2").Value & _
"\" & cell.Value & ".pdf"

更改 ThisworkbookSheet1到相关的工作簿或工作表。

关于vba - 从单元格中选择保存路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30516435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com