vbscript to dynamically update the excel cell range,when source data is updated and refresh the pivot table simultaneouslySelect a range in Excel vbscriptExcel Pivot table creation through vbscriptHow to enter values in cells in Excel in a column with VBscriptProperties of a cell in Excel (used in VBScript)?Create an Excel Table in VBScriptvbscript update excel spreadsheetCreating a Pivot table with VBScriptsplit excel cell using vbscriptSelecting Excel Cells with data in VBScriptVBScript for Excel “objWorkbook.RefreshAll” doesn't refresh data
Optimize a query reducing logical reads
Gave from hunger: Imperfect past tense of "feed"?
Fix Ethernet 10/100 PoE cable with 7 out of 8 wires alive
Does the app TikTok violate trademark?
What makes learning more difficult as we age?
Problematic Nature of Views
Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?
Another student has been assigned the same MSc thesis as mine (and already defended)
How to realistically describe pain?
What would influence an alien race to map their planet in a way other than the traditional map of the Earth
Is there any exception that proves or suggests that the law of non-contradiction does not always apply?
Can you trip a breaker from a different circuit?
Create the same subfolders in another folder
Is the order of words purely based on convention?
Why is STARTTLS still used?
String whitespaces
How do my husband and I get over our fear of having another difficult baby?
Is a Middle Name a Given Name?
Assembly of PCBs containing a mix of SMT and thru-hole parts?
What in my code changed between MacTeX 2017 and MacTex 2019?
お仕事に学校頑張って meaning
MaxDetect speed
How to adjust OS print output to different screen dimensions on VIC-20?
Calculate the Ultraradical
vbscript to dynamically update the excel cell range,when source data is updated and refresh the pivot table simultaneously
Select a range in Excel vbscriptExcel Pivot table creation through vbscriptHow to enter values in cells in Excel in a column with VBscriptProperties of a cell in Excel (used in VBScript)?Create an Excel Table in VBScriptvbscript update excel spreadsheetCreating a Pivot table with VBScriptsplit excel cell using vbscriptSelecting Excel Cells with data in VBScriptVBScript for Excel “objWorkbook.RefreshAll” doesn't refresh data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have an excel workbook consisting of a source data and a pivot table.
the source data gets updated with new records daily along with some changes in the existing data.
I have written a vbscript in notepad and saved it with .vbs and I am calling it from Rstudio to perform the refresh pivot table action.
But,when I run this script in Rstuido :
pathofvbscript = ("D:\Users\703225799\WIP\R\pivot\r5.vbs")
shell(shQuote(normalizePath(pathofvbscript)),"cscript",flag =
"//nologo")
I am getting the following error :
D:Users703225799WIPRpivotr5.vbs(14, 1) Microsoft VBScript runtime
error: Object doesn't support this property or method: 'objWB.Range'
VBS code :
'------------------------------------------------------------------------
'Set Pivot Table & Source Worksheet
'------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWB =
objExcel.Workbooks.Open("D:Users703225799WIPRpivotNew
folderBook1.xlsx")
Set Pivot_Sheet = objWB.Worksheets("pvt")
'-----------------------------------------------------------------------
'Enter in Pivot Table Name
'-----------------------------------------------------------------------
PivotName = "PivotTable1"
objWB.Activate
Set StartPoint = objWB.Range("A1")
LastCol = StartPoint.End(xlToRight).Column
DownCell = StartPoint.End(xlDown).Row
Set DataRange = Data_Sheet.Range(StartPoint, Cells(DownCell, LastCol))
New_range = objWB.Name & "!" & DataRange.Address(xlR1C1)
Pivot_Sheet.PivotTables(PivotName). _
ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(xlDatabase,NewRange)
'----------------------------------------------------------------------
'Ensure Pivot Table is Refreshed
'----------------------------------------------------------------------
Pivot_Sheet.PivotTables(PivotName).RefreshTable
'Data_Sheet.Save
'MsgBox "Your Pivot Table is now saved."
'Data_Sheet.Close
'MsgBox "Your Pivot Table is now closed."
'objExcel.Quit
'MsgBox "objExcel quit."
'----------------------------------------------------------------------
'Complete Message
'----------------------------------------------------------------------
Pivot_Sheet.Activate
MsgBox "Your Pivot Table is now updated."
objWB.Save
objWB.Close
set objExcel = Nothing
set Data_Sheet = Nothing
Set Pivot_Sheet = Nothing
Please help with the error.
Thanks,
Sayan
vbscript rstudio
add a comment
|
I have an excel workbook consisting of a source data and a pivot table.
the source data gets updated with new records daily along with some changes in the existing data.
I have written a vbscript in notepad and saved it with .vbs and I am calling it from Rstudio to perform the refresh pivot table action.
But,when I run this script in Rstuido :
pathofvbscript = ("D:\Users\703225799\WIP\R\pivot\r5.vbs")
shell(shQuote(normalizePath(pathofvbscript)),"cscript",flag =
"//nologo")
I am getting the following error :
D:Users703225799WIPRpivotr5.vbs(14, 1) Microsoft VBScript runtime
error: Object doesn't support this property or method: 'objWB.Range'
VBS code :
'------------------------------------------------------------------------
'Set Pivot Table & Source Worksheet
'------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWB =
objExcel.Workbooks.Open("D:Users703225799WIPRpivotNew
folderBook1.xlsx")
Set Pivot_Sheet = objWB.Worksheets("pvt")
'-----------------------------------------------------------------------
'Enter in Pivot Table Name
'-----------------------------------------------------------------------
PivotName = "PivotTable1"
objWB.Activate
Set StartPoint = objWB.Range("A1")
LastCol = StartPoint.End(xlToRight).Column
DownCell = StartPoint.End(xlDown).Row
Set DataRange = Data_Sheet.Range(StartPoint, Cells(DownCell, LastCol))
New_range = objWB.Name & "!" & DataRange.Address(xlR1C1)
Pivot_Sheet.PivotTables(PivotName). _
ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(xlDatabase,NewRange)
'----------------------------------------------------------------------
'Ensure Pivot Table is Refreshed
'----------------------------------------------------------------------
Pivot_Sheet.PivotTables(PivotName).RefreshTable
'Data_Sheet.Save
'MsgBox "Your Pivot Table is now saved."
'Data_Sheet.Close
'MsgBox "Your Pivot Table is now closed."
'objExcel.Quit
'MsgBox "objExcel quit."
'----------------------------------------------------------------------
'Complete Message
'----------------------------------------------------------------------
Pivot_Sheet.Activate
MsgBox "Your Pivot Table is now updated."
objWB.Save
objWB.Close
set objExcel = Nothing
set Data_Sheet = Nothing
Set Pivot_Sheet = Nothing
Please help with the error.
Thanks,
Sayan
vbscript rstudio
add a comment
|
I have an excel workbook consisting of a source data and a pivot table.
the source data gets updated with new records daily along with some changes in the existing data.
I have written a vbscript in notepad and saved it with .vbs and I am calling it from Rstudio to perform the refresh pivot table action.
But,when I run this script in Rstuido :
pathofvbscript = ("D:\Users\703225799\WIP\R\pivot\r5.vbs")
shell(shQuote(normalizePath(pathofvbscript)),"cscript",flag =
"//nologo")
I am getting the following error :
D:Users703225799WIPRpivotr5.vbs(14, 1) Microsoft VBScript runtime
error: Object doesn't support this property or method: 'objWB.Range'
VBS code :
'------------------------------------------------------------------------
'Set Pivot Table & Source Worksheet
'------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWB =
objExcel.Workbooks.Open("D:Users703225799WIPRpivotNew
folderBook1.xlsx")
Set Pivot_Sheet = objWB.Worksheets("pvt")
'-----------------------------------------------------------------------
'Enter in Pivot Table Name
'-----------------------------------------------------------------------
PivotName = "PivotTable1"
objWB.Activate
Set StartPoint = objWB.Range("A1")
LastCol = StartPoint.End(xlToRight).Column
DownCell = StartPoint.End(xlDown).Row
Set DataRange = Data_Sheet.Range(StartPoint, Cells(DownCell, LastCol))
New_range = objWB.Name & "!" & DataRange.Address(xlR1C1)
Pivot_Sheet.PivotTables(PivotName). _
ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(xlDatabase,NewRange)
'----------------------------------------------------------------------
'Ensure Pivot Table is Refreshed
'----------------------------------------------------------------------
Pivot_Sheet.PivotTables(PivotName).RefreshTable
'Data_Sheet.Save
'MsgBox "Your Pivot Table is now saved."
'Data_Sheet.Close
'MsgBox "Your Pivot Table is now closed."
'objExcel.Quit
'MsgBox "objExcel quit."
'----------------------------------------------------------------------
'Complete Message
'----------------------------------------------------------------------
Pivot_Sheet.Activate
MsgBox "Your Pivot Table is now updated."
objWB.Save
objWB.Close
set objExcel = Nothing
set Data_Sheet = Nothing
Set Pivot_Sheet = Nothing
Please help with the error.
Thanks,
Sayan
vbscript rstudio
I have an excel workbook consisting of a source data and a pivot table.
the source data gets updated with new records daily along with some changes in the existing data.
I have written a vbscript in notepad and saved it with .vbs and I am calling it from Rstudio to perform the refresh pivot table action.
But,when I run this script in Rstuido :
pathofvbscript = ("D:\Users\703225799\WIP\R\pivot\r5.vbs")
shell(shQuote(normalizePath(pathofvbscript)),"cscript",flag =
"//nologo")
I am getting the following error :
D:Users703225799WIPRpivotr5.vbs(14, 1) Microsoft VBScript runtime
error: Object doesn't support this property or method: 'objWB.Range'
VBS code :
'------------------------------------------------------------------------
'Set Pivot Table & Source Worksheet
'------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
Set objWB =
objExcel.Workbooks.Open("D:Users703225799WIPRpivotNew
folderBook1.xlsx")
Set Pivot_Sheet = objWB.Worksheets("pvt")
'-----------------------------------------------------------------------
'Enter in Pivot Table Name
'-----------------------------------------------------------------------
PivotName = "PivotTable1"
objWB.Activate
Set StartPoint = objWB.Range("A1")
LastCol = StartPoint.End(xlToRight).Column
DownCell = StartPoint.End(xlDown).Row
Set DataRange = Data_Sheet.Range(StartPoint, Cells(DownCell, LastCol))
New_range = objWB.Name & "!" & DataRange.Address(xlR1C1)
Pivot_Sheet.PivotTables(PivotName). _
ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(xlDatabase,NewRange)
'----------------------------------------------------------------------
'Ensure Pivot Table is Refreshed
'----------------------------------------------------------------------
Pivot_Sheet.PivotTables(PivotName).RefreshTable
'Data_Sheet.Save
'MsgBox "Your Pivot Table is now saved."
'Data_Sheet.Close
'MsgBox "Your Pivot Table is now closed."
'objExcel.Quit
'MsgBox "objExcel quit."
'----------------------------------------------------------------------
'Complete Message
'----------------------------------------------------------------------
Pivot_Sheet.Activate
MsgBox "Your Pivot Table is now updated."
objWB.Save
objWB.Close
set objExcel = Nothing
set Data_Sheet = Nothing
Set Pivot_Sheet = Nothing
Please help with the error.
Thanks,
Sayan
vbscript rstudio
vbscript rstudio
asked Mar 28 at 19:03
sayan chakrabortysayan chakraborty
112 bronze badges
112 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
Please try using Pivot_Sheet.Range("A1") instead of objWB.Range("A1") as the worksheet object is Pivot_sheet
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should beData_Sheet.Rangein this case.
– Geert Bellekens
Mar 29 at 9:47
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405101%2fvbscript-to-dynamically-update-the-excel-cell-range-when-source-data-is-updated%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please try using Pivot_Sheet.Range("A1") instead of objWB.Range("A1") as the worksheet object is Pivot_sheet
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should beData_Sheet.Rangein this case.
– Geert Bellekens
Mar 29 at 9:47
add a comment
|
Please try using Pivot_Sheet.Range("A1") instead of objWB.Range("A1") as the worksheet object is Pivot_sheet
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should beData_Sheet.Rangein this case.
– Geert Bellekens
Mar 29 at 9:47
add a comment
|
Please try using Pivot_Sheet.Range("A1") instead of objWB.Range("A1") as the worksheet object is Pivot_sheet
Please try using Pivot_Sheet.Range("A1") instead of objWB.Range("A1") as the worksheet object is Pivot_sheet
answered Mar 29 at 9:40
RaguRagu
93 bronze badges
93 bronze badges
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should beData_Sheet.Rangein this case.
– Geert Bellekens
Mar 29 at 9:47
add a comment
|
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should beData_Sheet.Rangein this case.
– Geert Bellekens
Mar 29 at 9:47
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
Workbook Object won't support 'Range' property that's why you are getting the exception
– Ragu
Mar 29 at 9:44
I'm pretty sure it should be
Data_Sheet.Range in this case.– Geert Bellekens
Mar 29 at 9:47
I'm pretty sure it should be
Data_Sheet.Range in this case.– Geert Bellekens
Mar 29 at 9:47
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405101%2fvbscript-to-dynamically-update-the-excel-cell-range-when-source-data-is-updated%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown