Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Set path

Hi iam using a macro to export from excel

how do i set the path for that perticular excel file

can some one tell me ?

what is the command to set the path ?

and also i want to know how do we rename the workbook

whwenever  i export it pops like worboo1 , workboo2

i want to rename this work book also

1 Solution

Accepted Solutions
simospa
Partner - Specialist
Partner - Specialist

John,

we gave you all the informations to do this.

In your script, insert yourself where you prefer to define your path the string

filePath = "F:\myFile.xls"  'your path

and, in your export to excel sub, after your

.CopyTableToClipboard true

or

XLSheet.paste


insert string


XLDoc.SaveAs filePath


Follow this trace,

S.

View solution in original post

9 Replies
simospa
Partner - Specialist
Partner - Specialist

Hi,

try to post a snippet.

S.

smilingjohn
Specialist
Specialist
Author

HI Simone Spanio

Plz find the attachment now tell me where do i mention the path here

simospa
Partner - Specialist
Partner - Specialist

Hi,

try this:

Sub sendToExcel 

     'Set the path where the excel will be saved  

     filePath = "F:\myFile.xls" 

 

     Set excelFile = CreateObject("Excel.Application") 

     excelFile.Visible = true 

     Set myWorkBook = excelFile.WorkBooks.Add 

     Set mySheet = myWorkBook.WorkSheets(1) 

 

     Set tableToExport = ActiveDocument.GetSheetObject("CH01") 

     Set chartProperties = tableToExport.GetProperties 

     tableToExport.CopyTableToClipboard true 

 

     excelFile.Visible = true

 

     myWorkBook.SaveAs filePath 

     myWorkBook.Close 

     excelFile.Quit 

 

     Set myWorkBook = nothing 

     Set excelFile = nothing 

End Sub 

Let me know if it works.

S.

simospa
Partner - Specialist
Partner - Specialist

John,

did it solve your problem?

S.

smilingjohn
Specialist
Specialist
Author

HI John I tried but its not working

Iam attaching the script in a word document can u please add the file path to the scrip ,

i want to save it into D:\Export\

Not applicable

Hi John,

refer this link , it may help you.

Regards,

Rajendra

smilingjohn
Specialist
Specialist
Author

Guys i have already posted my code just can some one add there path . I dont know how do we add the path

simospa
Partner - Specialist
Partner - Specialist

John,

we gave you all the informations to do this.

In your script, insert yourself where you prefer to define your path the string

filePath = "F:\myFile.xls"  'your path

and, in your export to excel sub, after your

.CopyTableToClipboard true

or

XLSheet.paste


insert string


XLDoc.SaveAs filePath


Follow this trace,

S.

smilingjohn
Specialist
Specialist
Author

Thanks simone.spanio