Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Guru's
As I wrote a macro to export the table content to excel file, the problem is I can store the file in my local machine but my requirement is when I click the button, the file will be stored in the network.
I am looking how the give the path with example.
Thanks in advance.
Joe
Try export or exportex and then change the format parameter based on what you want. 5 I think is Excel format
set obj = ActiveDocument.GetSheetObject("CH01")
obj.ExportEx "C:\test.xls", 5
I hope this helps.
The code is as in the below.
Sub to_excel
Dim wsname
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = false
Set XLDoc = XLApp.Workbooks.Add
wsname = ""
wsname = "Sheet1"
strFileName = "C:\test\Example1.xls"
ActiveDocument.ClearAll True
set obj = ActiveDocument.GetSheetObject("CH27")
obj.CopyTableToClipboard true
XLDoc.Sheets(wsname).Range("A7").Select
XLDoc.Sheets(wsname).Paste
XLApp.DisplayAlerts=false
XLDoc.SaveAs strFilename
XLDoc.Close
XLApp.Quit
end sub
I've copied your code and tried it by changing C:\test to \\<Computer Name>\<ShareName>\exampl1.xlsx and it does work. I'm using QV Desktop btw.
Thanks a lot... it works
Joe