How to use Save As function?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm attempting to have my workbook save as a macro-enabled workbook upon execution of my macro. When the macro is initiated, a userform will populate where the user can select a FiscalYear, FormYear, and a FormMonth. The reason for separate years is because FiscalYear will begin in Oct. Oct will be year 18, however it will begin FY19.
I am attempting to insert the value of the FiscalYear into my SaveAs function. The filepath stops after I use FiscalYear and it places the remaining string from the path in front of the DocName I am wanting the workbook to saveas:
Path "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName:"G22 Dashboard & " " & FormMonth & " " & "FY" & FiscalYear
The document will save in location "FY & FiscalYear &" as "Templates FY18G22 Dashboard & " " FormMonth & " " & "FY" & FiscalYear
Any advice to show me what I am doing incorrectly in this situation?
Probably a rookie mistake, but any help would be greatly appreciated, thanks!
I have attempted different syntax strategies (use of "" locations, & additions/removals).
Sub Save_Report_As()
'Disabling Display Alerts
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Path = "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName = "G22 Dashboard" & " " & FormMonth & " " & "FY" & FiscalYear
ActiveWorkbook.SaveAs filename:=Path & DocName, FileFormat:=52
'Enabling Display Alerts
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
excel vba excel-vba
add a comment |
I'm attempting to have my workbook save as a macro-enabled workbook upon execution of my macro. When the macro is initiated, a userform will populate where the user can select a FiscalYear, FormYear, and a FormMonth. The reason for separate years is because FiscalYear will begin in Oct. Oct will be year 18, however it will begin FY19.
I am attempting to insert the value of the FiscalYear into my SaveAs function. The filepath stops after I use FiscalYear and it places the remaining string from the path in front of the DocName I am wanting the workbook to saveas:
Path "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName:"G22 Dashboard & " " & FormMonth & " " & "FY" & FiscalYear
The document will save in location "FY & FiscalYear &" as "Templates FY18G22 Dashboard & " " FormMonth & " " & "FY" & FiscalYear
Any advice to show me what I am doing incorrectly in this situation?
Probably a rookie mistake, but any help would be greatly appreciated, thanks!
I have attempted different syntax strategies (use of "" locations, & additions/removals).
Sub Save_Report_As()
'Disabling Display Alerts
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Path = "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName = "G22 Dashboard" & " " & FormMonth & " " & "FY" & FiscalYear
ActiveWorkbook.SaveAs filename:=Path & DocName, FileFormat:=52
'Enabling Display Alerts
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
excel vba excel-vba
2
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
1
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04
add a comment |
I'm attempting to have my workbook save as a macro-enabled workbook upon execution of my macro. When the macro is initiated, a userform will populate where the user can select a FiscalYear, FormYear, and a FormMonth. The reason for separate years is because FiscalYear will begin in Oct. Oct will be year 18, however it will begin FY19.
I am attempting to insert the value of the FiscalYear into my SaveAs function. The filepath stops after I use FiscalYear and it places the remaining string from the path in front of the DocName I am wanting the workbook to saveas:
Path "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName:"G22 Dashboard & " " & FormMonth & " " & "FY" & FiscalYear
The document will save in location "FY & FiscalYear &" as "Templates FY18G22 Dashboard & " " FormMonth & " " & "FY" & FiscalYear
Any advice to show me what I am doing incorrectly in this situation?
Probably a rookie mistake, but any help would be greatly appreciated, thanks!
I have attempted different syntax strategies (use of "" locations, & additions/removals).
Sub Save_Report_As()
'Disabling Display Alerts
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Path = "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName = "G22 Dashboard" & " " & FormMonth & " " & "FY" & FiscalYear
ActiveWorkbook.SaveAs filename:=Path & DocName, FileFormat:=52
'Enabling Display Alerts
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
excel vba excel-vba
I'm attempting to have my workbook save as a macro-enabled workbook upon execution of my macro. When the macro is initiated, a userform will populate where the user can select a FiscalYear, FormYear, and a FormMonth. The reason for separate years is because FiscalYear will begin in Oct. Oct will be year 18, however it will begin FY19.
I am attempting to insert the value of the FiscalYear into my SaveAs function. The filepath stops after I use FiscalYear and it places the remaining string from the path in front of the DocName I am wanting the workbook to saveas:
Path "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName:"G22 Dashboard & " " & FormMonth & " " & "FY" & FiscalYear
The document will save in location "FY & FiscalYear &" as "Templates FY18G22 Dashboard & " " FormMonth & " " & "FY" & FiscalYear
Any advice to show me what I am doing incorrectly in this situation?
Probably a rookie mistake, but any help would be greatly appreciated, thanks!
I have attempted different syntax strategies (use of "" locations, & additions/removals).
Sub Save_Report_As()
'Disabling Display Alerts
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Path = "J:xyzFY" & FiscalYear & "Templates FY" & FiscalYear
DocName = "G22 Dashboard" & " " & FormMonth & " " & "FY" & FiscalYear
ActiveWorkbook.SaveAs filename:=Path & DocName, FileFormat:=52
'Enabling Display Alerts
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
excel vba excel-vba
excel vba excel-vba
edited Jan 3 at 15:54
J.schmidt
661120
661120
asked Jan 3 at 14:26
Derek HardenDerek Harden
215
215
2
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
1
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04
add a comment |
2
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
1
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04
2
2
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
1
1
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04
add a comment |
1 Answer
1
active
oldest
votes
Will post my comment as an answer so this will stop showing up on the "unanswered" list:
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024243%2fhow-to-use-save-as-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Will post my comment as an answer so this will stop showing up on the "unanswered" list:
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
add a comment |
Will post my comment as an answer so this will stop showing up on the "unanswered" list:
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
add a comment |
Will post my comment as an answer so this will stop showing up on the "unanswered" list:
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
Will post my comment as an answer so this will stop showing up on the "unanswered" list:
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
answered Jan 3 at 15:33


CyrilCyril
3,2001924
3,2001924
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024243%2fhow-to-use-save-as-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You need to add the file extension as part of Path string.
– Ryan Wildry
Jan 3 at 14:29
1
path & "" & docname & ".xlsx" would be more appropriate... you left out the "" between the pathdocname plus the extension (@RyanWildry caught the extension, too)
– Cyril
Jan 3 at 14:31
@Cyril Good catch. It would sure be helpful to know what is in the FiscalYear variable.
– Ryan Wildry
Jan 3 at 14:37
Thanks for the assist! Still newer to VBA and working out these little kinks. That worked like a charm and I appreciate your guys' help. Final question: In the code I have FileFormat:=52 for a macro-enabled workbook. Is a file extension required on the DocName if I have the FileFormat:=52 in the SaveAs line?
– Derek Harden
Jan 3 at 14:45
you need to match the file format to the extension, e.g., .xlsb = fileformat 50, so yes you need both. see: rondebruin.nl/win/s5/win001.htm
– Cyril
Jan 3 at 15:04