LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default difference between XL VBA on Windows and the Mac???


1. Dave F
View profile
More options Dec 26 2006, 2:16 pm
Newsgroups: microsoft.public.excel.misc
From: "Dave F"
Date: 26 Dec 2006 11:16:46 -0800
Local: Tues, Dec 26 2006 2:16 pm
Subject: difference between XL VBA on Windows and the Mac???
Reply to author | Forward | Print | Individual message | Show original |
Report this message | Find messages by this author
I just tried running a macro and got the following error:

"Run time error '1004': Methos 'Refresh' of object '_QueryTable'
failed"

This same macro runs fine on a Windows computer. The macro code in
question is:

Set qt = ActiveSheet.QueryTables.Add(Connection:=connectstr ing,
Destination:=ActiveSheet.Range("tickers").Offset(0 , 1))

With qt
.Name = "T1"
.AdjustColumnWidth = False
.RefreshStyle = xlOverwriteCells
.RefreshOnFileOpen = False
.Refresh
End With

Ideas?


2. Jon Peltier
View profile
More options Dec 26 2006, 2:37 pm
Newsgroups: microsoft.public.excel.misc
From: "Jon Peltier"
Date: Tue, 26 Dec 2006 14:37:23 -0500
Local: Tues, Dec 26 2006 2:37 pm
Subject: difference between XL VBA on Windows and the Mac???
Reply to author | Forward | Print | Individual message | Show original |
Report this message | Find messages by this author
As answered in .programming:

Excel on a Mac uses the VBA equivalent of Excel 97. In Excel 97, query
tables do not have the property AdjustColumnWidth (it was added in Excel
2000), causing the code to fail on the Mac.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______

"Dave F" wrote in message

ups.com...

- Hide quoted text -
- Show quoted text -
I just tried running a macro and got the following error:


"Run time error '1004': Methos 'Refresh' of object '_QueryTable'
failed"


This same macro runs fine on a Windows computer. The macro code in
question is:


Set qt = ActiveSheet.QueryTables.Add(Connection:=connectstr ing,
Destination:=ActiveSheet.Range("tickers").Offset(0 , 1))


With qt
.Name = "T1"
.AdjustColumnWidth = False
.RefreshStyle = xlOverwriteCells
.RefreshOnFileOpen = False
.Refresh
End With


Ideas?




3. Dave F
View profile
More options Dec 26 2006, 3:02 pm
Newsgroups: microsoft.public.excel.misc
From: "Dave F"
Date: 26 Dec 2006 12:02:37 -0800
Local: Tues, Dec 26 2006 3:02 pm
Subject: difference between XL VBA on Windows and the Mac???
Reply to author | Forward | Print | Individual message | Show original |
Report this message | Find messages by this author
Thanks, Jon.

Unfortunately I didn't see a response to my post in the .programming
newsgroup.

Dave

- Hide quoted text -
- Show quoted text -
Jon Peltier wrote:
As answered in .programming:


Excel on a Mac uses the VBA equivalent of Excel 97. In Excel 97, query
tables do not have the property AdjustColumnWidth (it was added in Excel
2000), causing the code to fail on the Mac.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Dave F" wrote in message
ups.com...
I just tried running a macro and got the following error:


"Run time error '1004': Methos 'Refresh' of object '_QueryTable'
failed"


This same macro runs fine on a Windows computer. The macro code in
question is:


Set qt = ActiveSheet.QueryTables.Add(Connection:=connectstr ing,
Destination:=ActiveSheet.Range("tickers").Offset(0 , 1))


With qt
.Name = "T1"
.AdjustColumnWidth = False
.RefreshStyle = xlOverwriteCells
.RefreshOnFileOpen = False
.Refresh
End With


Ideas?


Hi,

It appears that .AdjustColumnWidth is supposed to work on the Mac.
Excel's help discusses it, but the command appears to have no effect
when I tried it. The command AdjustColumnWidth does not produce any
error, so no harm is done.

The AutoFormat property may accomplish what you are seeking. Just add
this to the list in With qt
.HasAutoFormat = True

The List Manager has to be "off" in order to use this command. Use a
form of this statement to turn the List Manager off if it is already on:
ActiveSheet.ListObjects("List1").ConvertToRange

-Jim

--
Jim Gordon
Mac MVP

MVPs are independent experts who are not affiliated with Microsoft.
http://mvp.support.microsoft.com/
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference betweeen Windows and Office Clipboards? jmc Excel Discussion (Misc queries) 1 February 6th 08 08:24 PM
can windows vista edit shared document from windows xp sasa Excel Worksheet Functions 1 January 9th 08 06:44 PM
difference between XL VBA on Windows and the Mac??? Dave F Excel Discussion (Misc queries) 2 December 26th 06 08:02 PM
Page breaks are different in Windows 2000 and Windows XP Bill Allen Excel Discussion (Misc queries) 1 November 23rd 05 04:42 PM
charting a difference of 2 columns' w/o adding a difference column Wab Charts and Charting in Excel 4 July 27th 05 02:37 AM


All times are GMT +1. The time now is 03:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"