Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to give the file name dynamically using variable name
#1
Not Solved
[i]
Code:
Dim xlApp
Dim xlBook
Dim xlSheet
Dim x
x= sanity
Set xlApp=CreateObject("Excel.Application")
Set xlBook=xlApp.workbooks.add
Set xlSheet=xlBook.activesheet
xlSheet.cells(1,1)="Oppurtunity Id"
xlSheet.cells(1,2)= MSG16
xlBook.saveas "C:\[color=#FF0000]"x".[/color]xls"
xlApp.quit


Here iam trying to save file name as sanity.xls
Where i am taking file name from variable x
But iam getting error
How to save the file name like this
Reply
#2
Not Solved
try this:

xlBook.saveas "C:\"&x&".xls"
Reply
#3
Not Solved
Getting:
SaveAs method of Workbook class failedLine (14): "xlBook.saveas "C:\Documents and Settings\SXCHA19\Desktop\"&x&".xls""
Reply
#4
Not Solved
Hi,

Here we go...
Code:
Dim xlApp
Dim xlBook
Dim xlSheet
Dim x
x= "sanity"
Set xlApp=CreateObject("Excel.Application")
Set xlBook=xlApp.workbooks.add
Set xlSheet=xlBook.Activesheet
xlSheet.cells(1,1)="Oppurtunity Id"
xlSheet.cells(1,2)= "MSG16"
xlBook.saveas "C:\"&x&".xls"
xlApp.quit
Set xlApp=Nothing
Reply
#5
Not Solved
Thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,346 03-02-2020, 09:33 PM
Last Post: Swishy70
  Unable to capture value of Webelement which is changing dynamically sheetal 9 16,209 02-16-2018, 11:01 AM
Last Post: janki_kakadia
  Unable to click on dynamically changing webelement preeti 0 1,807 04-29-2017, 08:50 PM
Last Post: preeti
  Adding data into rows that add dynamically with setcelldata azar81 4 5,916 04-13-2015, 05:24 PM
Last Post: vidya2k2
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 5,618 01-17-2015, 07:49 PM
Last Post: yogi4tech

Forum Jump:


Users browsing this thread: 2 Guest(s)