runtime error 1004 :PDF Export to Onedrive sub-folder

suthees

New Member
Joined
Dec 18, 2018
Messages
1
Hi Experts,
I have a problem so far, I tried to export my code to PDF format,
the situation is runtime error 1004

what i did so far is that .

with this path work just fine
Filename:="https://d.docs.live.net/FBC3F27912XYZ123/Homeandcare work/Invoice Record History/" & "61_" & bil_id & "_" & bildate & "_" & comname & ".pdf", _
the code exported to pdf to "Invoice Record History" folder properly

however, after i add another subfolder

Filename:="https://d.docs.live.net/FBC3F27912XYZ123/Homeandcare work/Invoice Record History/BillingReport/" & "61_" & bil_id & "_" & bildate & "_" & comname & ".pdf", _

turn out this comes with runtime error and export is unsuccessful

if any of you guys have familiar with this problem before please help
--------------------------------------------------------------------------------------------------------------
Sub Billing_saveas()


Dim bil_id As String
bil_id = Format(Range("L6"), "00000")
'Range("T2").Value = bil_id


Dim bildate As String
bildate = Format(Range("L7"), "yyyy_mm_dd")


Dim comname As String
comname = Range("L5")


ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="https://d.docs.live.net/FBC3F27912XYZ123/Homeandcare work/Invoice Record History/BillingReport/" & "61_" & bil_id & "_" & bildate & "_" & comname & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False





End Sub
----------------------------------------------------------------------------------------------------------------------------------
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,738
Office Version
2013
Platform
Windows
Check to make sure the syntax of the BillingReport is correct...no spaces, underscores,capitals, etc
Make sure the folder is accessible
 

Watch MrExcel Video

Forum statistics

Threads
1,095,176
Messages
5,442,835
Members
405,201
Latest member
kashyap44

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top