Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Relatife Path in Macro

How to write relative path in Qlikview Macro? I need it because i want to overwrite an Excel file in the Qlikview Server.

Thanks

3 Replies
Miguel_Angel_Baeyens

Hi,

Are you using ServerSideExportEx instead of ExportEx? That should work when referring to the drives in the Server locally. Anyway, using UNC paths are likely to work.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

I show my code :

Sub SaveToExcel

    set v = ActiveDocument.Variables("vSubject")

    varSubject = v.GetContent.String

    set v = ActiveDocument.Variables("vBody")

    varBody = v.GetContent.String

    NewFileName = "\DataEmail.xlsx"

    set XLApp = CreateObject("Excel.Application")

    XLApp.Visible = false

    set XLDoc = XLApp.Workbooks.Add

    XLDoc.Sheets(1).Range("A1") = "Subject"

    XLDoc.Sheets(1).Range("A2") = varSubject

    XLDoc.Sheets(1).Range("B1") = "Body"

    XLDoc.Sheets(1).Range("B2") = varBody

    XLDoc.SaveAs NewFileName

    XLApp.Quit

    MsgBox("Save is successfull")

end sub

Can you show me the right code how to save with relative path in server if i want to save from another computer using browser?

because NewFileName = "\DataEmail.xlsx" is not the right path

Thanks

Miguel_Angel_Baeyens

Hi,

Did you try "\\SERVER\SharedResource\File.xlsx" ? And just the file name (no folders nor drives)? I was not talking about these objects, rather than the QlikView API ones to export a chart to a file.

Regards.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica