excel_learnerz
Board Regular
- Joined
- Dec 12, 2018
- Messages
- 73
I am new to VBA and have to complete a task for my manager about saving sheet as a pdf into sharepoint (if firstly can be done) which creates a folder at the location with the same name as the saved PDF and saves the pdf there.Now where it gets harder for me is at the location in sharepoint there are 3 folders, for USD, EUR and GBP and depending on a field in the excel (which will denote one of the 3 currencies) it will have to be saved at that location(Sharepoint URL or mapped to network drive)\Quote\USD\new folder created with file name matching pdf\pdf file(Sharepoint URL or mapped to network drive)\Quote\EUR\new folder created with file name matching pdf\pdf file(Sharepoint URL or mapped to network drive)\Quote\GBP\new folder created with file name matching pdf\pdf fileIs it the sharepoint URL will work or is it only when mapped to the network drive (which I have with a filepath with my username which im guessing would stop working from anyone else but me)I am using the below which saves to sharepoint but with me as User_1 I cant see how anyone else will be able to?
<code style="background-color: rgb(239, 240, 241); border-bottom-color: rgb(57, 51, 24); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(57, 51, 24); border-left-style: none; border-left-width: 0px; border-right-color: rgb(57, 51, 24); border-right-style: none; border-right-width: 0px; border-top-color: rgb(57, 51, 24); border-top-style: none; border-top-width: 0px; box-sizing: border-box; font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif; font-size: 13px; font-size-adjust: none; font-stretch: 100%; font-style: normal; font-variant: normal; font-weight: 400; line-height: 16.9px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;">Sub test()ChDir "C:\Users\user_1\company\Sales Team - Documents\Quotes"
With Sheets("Quote")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:\Users\user_1\company\Sales Team - Documents\Quotes" & ActiveSheet.Range("B2").Value & " Quote.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End With
end sub</code>
It took me a while to figure out the above (which im sure is really simple) but i am still learning,
So I think I need a Case and If and Else to make this happen but I am not sure how to structure it and create folders at the same time
Can anyone help me with this?Thanks
So I think I need a Case and If and Else to make this happen but I am not sure how to structure it and create folders at the same time
Can anyone help me with this?Thanks